From 8af150dc3677a8a178df0840e5f4ab2e2ff594de Mon Sep 17 00:00:00 2001 From: "Ilya (Marshal)" Date: Wed, 30 Sep 2026 20:46:37 +0200 Subject: [PATCH] Add Linux aarch64 wheels --- .github/workflows/ci.yml | 15 +- README.md | 6 +- cmake/libcxx/README.md | 13 +- cmake/libcxx/runtime.sha256 | 275 ++++++++++++++++++++++++++++++++++++ cmake/libcxx/update.py | 187 ++++++++++++++++++------ cmake/libwebrtc.cmake | 111 ++++++++++++--- pyproject.toml | 7 +- 7 files changed, 533 insertions(+), 81 deletions(-) create mode 100644 cmake/libcxx/runtime.sha256 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e46255f..efd4736 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-15-intel, macos-15, windows-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-15, windows-latest] # PRs: oldest and newest only python: ${{ fromJSON(github.event_name == 'pull_request' && '["cp39","cp314"]' || '["cp39","cp310","cp311","cp312","cp313","cp314"]') }} env: @@ -90,10 +90,17 @@ jobs: path: wheelhouse/*.whl sanitizers: - name: sanitizers (ASan + UBSan) - runs-on: ubuntu-latest - container: quay.io/pypa/manylinux_2_28_x86_64 + name: sanitizers (ASan + UBSan, ${{ matrix.arch }}) + runs-on: ${{ matrix.runner }} + container: quay.io/pypa/manylinux_2_28_${{ matrix.arch }} timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - { arch: x86_64, runner: ubuntu-latest } + # also covers the libc++ built from source for arm64 + - { arch: aarch64, runner: ubuntu-24.04-arm } steps: - uses: actions/checkout@v7 - run: .github/scripts/sanitizers.sh diff --git a/README.md b/README.md index 5af36c1..9555b7f 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ if __name__ == '__main__': Python 3.9 – 3.14 (CPython) on: -| Linux | macOS | Windows | -|--------------------------------|--------------------------------|---------| -| x86_64 (glibc 2.27+, manylinux) | 13+, Intel and Apple Silicon | x64 | +| Linux | macOS | Windows | +|---------------------------------------------|------------------------------|---------| +| x86_64 and aarch64 (glibc 2.27+, manylinux) | 13+, Intel and Apple Silicon | x64 | #### Building from sources (sdist) diff --git a/cmake/libcxx/README.md b/cmake/libcxx/README.md index c6dea3b..147837e 100644 --- a/cmake/libcxx/README.md +++ b/cmake/libcxx/README.md @@ -6,11 +6,16 @@ and verifies them against these lists: llvm-project at `LIBCXX_LLVM_COMMIT`. - `config.sha256` — Chromium's build-generated `__config_site` and `__assertion_handler`, fetched from `buildtools/third_party/libc++/` at `LIBCXX_CHROMIUM_TAG`. +- `runtime.sha256` — the libc++ and libc++abi sources Chromium builds (from its `BUILD.gn` at + `LIBCXX_CHROMIUM_TAG`) and every file they include, fetched from llvm-project at `LIBCXX_LLVM_COMMIT`, + `LIBCXXABI_LLVM_COMMIT` and `LLVM_LIBC_COMMIT`. The linux-arm64 prebuilt lacks the compiled runtime, so + CMake builds it from these into a static `chromium_libcxx`. -Both variables live in `cmake/libwebrtc.cmake`. When bumping `LIBWEBRTC_VERSION`, unpack the new -`libwebrtc-linux-x64.tar.xz` and run +The commits are the ones WebRTC's `DEPS` pins libc++, libc++abi and llvm-libc at, resolved from Chromium's +per-directory mirrors to llvm-project. All variables live in `cmake/libwebrtc.cmake`. When bumping +`LIBWEBRTC_VERSION`, unpack the new `libwebrtc-linux-x64.tar.xz` and run python cmake/libcxx/update.py /include/third_party/libc++/src/include \ - --chromium-tag --since ... --until ... + --webrtc-branch --chromium-tag -with a window of ~3 months before the Chromium branch point, then set both variables to the printed values. +then set the variables to the printed values. diff --git a/cmake/libcxx/runtime.sha256 b/cmake/libcxx/runtime.sha256 new file mode 100644 index 0000000..2982776 --- /dev/null +++ b/cmake/libcxx/runtime.sha256 @@ -0,0 +1,275 @@ +a689d673918f58096a11f635a9f99135d0ef759ddfbc88c383ecf7b1e3c6c501 libc/hdr/errno_macros.h +bfa06cc002376a534cb1231783d3b3a538df32f48fe698c1b14b976229cfd00b libc/hdr/fenv_macros.h +b4e0240a2da93480d71708ccea15b36ccb504414b08797949a55af4a879c53cd libc/hdr/float_macros.h +0875819584022bd9ffe7bf8ff2181177517fcfed220ef819e5488f77149f0d21 libc/hdr/limits_macros.h +661348f7d45c035e904ec99c4eb8dea9e09c860a31218c40e39c841cd5b7bcf5 libc/hdr/stdint_proxy.h +a47c73b8a31d6b31bc9ddfc8681ea8d68221f0dc466bce66e7dc17b28309b3a9 libc/hdr/types/size_t.h +52058de4803f6b5eb316062d53c5ab67cb448ba12c95abd279250c6a25bbd8dc libc/hdr/types/ssize_t.h +1d58f7d7161d638aba62493ca30e569e88c4d1095339fa074c2f34dfa30fbb26 libc/hdr/types/wchar_t.h +de4bd00358aeedebe207dc487570a282e5376a665ea3ddb3504f7a579ecef620 libc/hdr/types/wint_t.h +6f5d4e2f1d87cb313af2f58fbd5b50ba10b4e71e2bdfb531227e0f00ade5c397 libc/hdr/wchar_overlay.h +3bcca098e3650a2048d8159f8349f62eb398fdc06be18aca18493ecf00e095f0 libc/include/llvm-libc-macros/cfloat128-macros.h +4110a4b63fa76caf25ddd491c3ef08495af410f5c92afa6d43907ccf59782ba3 libc/include/llvm-libc-macros/cfloat16-macros.h +a50ab3905dd1e79e57a47e32db2856901b7de9bc88d293b53357ff64c1751d98 libc/include/llvm-libc-macros/error-number-macros.h +bc5e2cf1cbf1fff334f45eb58b331bf4ef604446d5a5b291c8cf2b7bf8883bf7 libc/include/llvm-libc-macros/fenv-macros.h +2960f7db2c9dccd5295c1ed715cd4e91af481e57aed79e463ac69c7766082051 libc/include/llvm-libc-macros/float-macros.h +15a4196a26ad3c38bdfd4b0f646d69f21b6d58076e534fe7debc252e2c403de3 libc/include/llvm-libc-macros/float16-macros.h +fba56c7f8c617cf2977faea9fd05d69730b17e8c30b24d4b957c2d98a945af28 libc/include/llvm-libc-macros/generic-error-number-macros.h +6cc12ddd57b58e5ff2909a25154b8dc1a48ef7441c6be70e5f3507db4ad3e897 libc/include/llvm-libc-macros/limits-macros.h +1b54c1f795cf538ba6b4091df27dd7d28ea10ce139f724e0502043821917276d libc/include/llvm-libc-macros/linux/error-number-macros.h +5d4f6476cb0b1e6ddf76a1e0fa1db8324d76a372cdd1f0f978d9c65d4e291159 libc/include/llvm-libc-macros/stdfix-macros.h +10d15329e8149cfefb6385f19cf14e4a86aca6cbf83cdcf36801fb5113af9aed libc/include/llvm-libc-types/cfloat128.h +bb0fb2145874d45a9c89505ead6f3a5bcf98c1c89e057b067e3f6b0ac0ccd11e libc/include/llvm-libc-types/cfloat16.h +940638bee993f2c4e5e96c66ea97478d1067131797a379db416b9d09240f4d82 libc/include/llvm-libc-types/float128.h +5a7a6ed640a5f29f7e63d936980d77e087c1ba60eba572f61dc59d83a71b293f libc/include/llvm-libc-types/size_t.h +54e1fdb3adb5bcc9c6f19d8d1442dc9c5f7fa5443d252cbae3527b15f34e11eb libc/include/llvm-libc-types/ssize_t.h +016b780f922e595420ce04a2aa43c1a283dd4f8b7a5b2e54d524d0c3b15046dd libc/include/llvm-libc-types/wchar_t.h +ee322165336ea6a08ababd87446230b89cf7ed38932267a129c44898593e5e6d libc/include/llvm-libc-types/wint_t.h +4f2e29e66446ae730c2b33d852352bece3122954888587dcb4f13a738f6867e5 libc/shared/fp_bits.h +6082d8c55f1b61bef145407c5b5d7c4e5c6768cc14a980720aa34a026de1cd32 libc/shared/libc_common.h +c700e195521320ad601f2e6072a763f0708a7a59b1a6528e5e1df2c3fb11e780 libc/shared/str_to_float.h +ff36bccd241a13723659e1b41cb559d08a17d23c63ca3b102b950aa5072da709 libc/shared/str_to_integer.h +00a24608254dae857ee299bd4512cda0c47f0d48ce9e80751bce9430ce84369e libc/src/__support/CPP/algorithm.h +dfda1b4f82e9b261acf54dd720a73c6cc9713109a95a4f8a9d3cd15a1ed155cb libc/src/__support/CPP/array.h +df0f1162716be2904d6e2b614c7c5696e1e43506f15cb07666f831fb6e13f040 libc/src/__support/CPP/bit.h +f06b32b05f3e2a9e69467944fe4afd820b6ab2aff7c5b1555cc5fdf69339a0b4 libc/src/__support/CPP/expected.h +84323639ea83641ee2476d6163ade0071e4e0ae2b9e0d9a66fa4ae343d5924da libc/src/__support/CPP/iterator.h +8130915bcd6e97f4058d8b48942186c4cf0187522977d0ce87dab4a83bb850ec libc/src/__support/CPP/limits.h +94ebea1e0ba9a2eed6d0a0b58575cbb85fce3806b92c706dab13ff9c6baa1994 libc/src/__support/CPP/optional.h +01dea95d71c3e4c648d08df5ef998c6a0b1f4815140b7567162b36d44d421abb libc/src/__support/CPP/span.h +d6eeffa19eab5859d4290c721f781812df8849fe051ac92301ceff28aa457f4b libc/src/__support/CPP/string_view.h +75bb93fa75f54abfcfbb05253cdd407ac476b0ce2fb4e8bb3892af32d4016b80 libc/src/__support/CPP/type_traits.h +922ccbd50ba6aa312dba09f34f5a273024dd60f5fcc164b143f3ee36df4b09a8 libc/src/__support/CPP/type_traits/add_lvalue_reference.h +41129ca66f61c275f4f141dc1b51262dc7a177e951b2904803609864dd659a72 libc/src/__support/CPP/type_traits/add_pointer.h +22d9d1d1c7ddb951a850d5609856f702b650f020388d7c49940b0f0f06ad0178 libc/src/__support/CPP/type_traits/add_rvalue_reference.h +c30bad387a0e992db668532acb6e6d1a311f2004ffbdb17b29c1ffc33fe6a795 libc/src/__support/CPP/type_traits/aligned_storage.h +ab9f97d0b3e128fc22f67086d7854b35dbeec1b8fdd7de66792e24f9f5132597 libc/src/__support/CPP/type_traits/always_false.h +a4d91d87d201d6953c68fdbbfbcd6e009bfc1e4d3468f2779fcf468a39873032 libc/src/__support/CPP/type_traits/bool_constant.h +9a4a2074bdc737b7e1ab586b5062617178da7def7b29b0d62b1f9c31c59c5656 libc/src/__support/CPP/type_traits/conditional.h +1680751c40cc6f1ee9d30a8e672391bad151109d230b122594b0d546a7e2e21c libc/src/__support/CPP/type_traits/decay.h +d5c360cbfc74283eb2ac17089607f740d0ee874cea6dba1bd598404364f924d6 libc/src/__support/CPP/type_traits/enable_if.h +a4b8de2e728c787d64f23ddc363de6c79d3873ba11446ea437b19da00d13972d libc/src/__support/CPP/type_traits/false_type.h +47c255fce1da848fdfacc0869b8f350066fe998439c821bf337a05c8faca37f3 libc/src/__support/CPP/type_traits/has_unique_object_representations.h +43bf74239a5d69812c4aff16603aa80d2b39498a4628d7bbd4dd2be135473c70 libc/src/__support/CPP/type_traits/integral_constant.h +1bcc5872ffb795c0385d3f1384d2fe3ecdac88346af0067d1aaf74ec1c89f394 libc/src/__support/CPP/type_traits/invoke.h +bd95e0166f8e424f77c94aaa70660155fcd2d77af270b4021e5d5645bd4a176c libc/src/__support/CPP/type_traits/invoke_result.h +7c81ee9037216e29afbf75401d15773a53ec23fe49a4e5e5de6765ab1b7269a3 libc/src/__support/CPP/type_traits/is_arithmetic.h +dc7c5f40390770e5c3864098411ab9bd712f3b01eb75720f05a4d0a671494767 libc/src/__support/CPP/type_traits/is_array.h +18bf84123c904955bd4d1fce02e24c7296061d5c8d18c27cde50d01597e02804 libc/src/__support/CPP/type_traits/is_assignable.h +beffe971074adaa39b08824e58e23d4052b1972d805c6d6ed75c6c4f33fea60a libc/src/__support/CPP/type_traits/is_base_of.h +42210e9500a70f4a8ee77fe2d8362d00e81e5fc50f6cb18705eca75456595499 libc/src/__support/CPP/type_traits/is_class.h +7b2f538ccfab6f46392712214378a0128d14fb1af9e103f8a8ec087da641411e libc/src/__support/CPP/type_traits/is_complex.h +529905320a2def61fbb656bcf65fa9f68984b74ff22d73fbb1d22fa530a7b1a9 libc/src/__support/CPP/type_traits/is_const.h +556a639386833419c17dc458af8fa48f16957a1d585c8c6239033ccfe31a5daf libc/src/__support/CPP/type_traits/is_constant_evaluated.h +a0901da8edae1e2f17acf059660c729d4a06b9a96d5fa8035f0678c84fc7d644 libc/src/__support/CPP/type_traits/is_constructible.h +731b42f6fb289be2efac5d6accb637bfdbadd5f41b13bb7a7285c9cb6af79f25 libc/src/__support/CPP/type_traits/is_convertible.h +0f740053830090d55ac26bee2a82f0de8545ef35982a8c96c822806ab4097059 libc/src/__support/CPP/type_traits/is_copy_assignable.h +7c935922ac79d4d9af286d54d7d0432332ba154a9c6e14f8a8cf85f4930ec1f4 libc/src/__support/CPP/type_traits/is_copy_constructible.h +aa63de7204de21908593af635fbd0fae2b50a6d113137aa493cd6614158fd61d libc/src/__support/CPP/type_traits/is_destructible.h +e9cbccc3b8995b663fa71e0f607b6e75a5eae792592409b342cd80e5c90898a2 libc/src/__support/CPP/type_traits/is_enum.h +06c89f063a4f867729a9fe2d77d0f1e0f26b1e46c8b10e81b27ffcef196ed87b libc/src/__support/CPP/type_traits/is_fixed_point.h +3e60201074dcd81bc927ac3242b5658cdcdc03ab7100a56bfc87d7b4a80d8e62 libc/src/__support/CPP/type_traits/is_floating_point.h +d89f1c400b0825bba2fc6f7efe5225a3e41f1135fafbebbebbbc1f0650b1bbcd libc/src/__support/CPP/type_traits/is_function.h +d0b19c6cb14e59e137752abf7b80b0fa00d95fc97bb8ec1cf0573e28e53a7f43 libc/src/__support/CPP/type_traits/is_integral.h +cf4a9b93b5d0e5ea11bab046d57581fec1848a1081663a8a2903582984ccb2c9 libc/src/__support/CPP/type_traits/is_lvalue_reference.h +3bc303a9f8791e316cc3fe74cc51789db05b96220e118d00184bf0555a929dd2 libc/src/__support/CPP/type_traits/is_member_pointer.h +678cdbf591ce3d822ff8ee75ab6a5a3353f2c649acaca36fad5bcc4e4f41f775 libc/src/__support/CPP/type_traits/is_move_assignable.h +0624a2f8c27dfcf5a59275460c2788fe4085313f602f40eaa683552d8aef9329 libc/src/__support/CPP/type_traits/is_move_constructible.h +c9cb3e4d760b4668ebfe562c5ca8f0e3d2acfb9452e77d3dd3db3076f7cf0fb4 libc/src/__support/CPP/type_traits/is_null_pointer.h +e6699d0bb2c281953850510233ba96ffb9f6652c653041746ef9a5b755b28943 libc/src/__support/CPP/type_traits/is_object.h +c8e3190c920ef43b005aff035be389466a5e4541add7390e7b786e7ba809ef43 libc/src/__support/CPP/type_traits/is_pointer.h +0038d53f09e175cd3b4ebfb1cd64905e8e4163da73af93362af36bef185676cb libc/src/__support/CPP/type_traits/is_reference.h +ed403b81ecbf4c43c0e2b27aeae0ba94dec98f8f4f2dd548a274d0e85c4353f7 libc/src/__support/CPP/type_traits/is_rvalue_reference.h +74daede907df025779b94241e9fa10d53260ed24c52f38cb56c93fd9076e22d8 libc/src/__support/CPP/type_traits/is_same.h +7bd3331a0355f28480aada6b9721607ce71e1266a629413d3d16dd0bad789d08 libc/src/__support/CPP/type_traits/is_scalar.h +94fbbd7b03f8a0379d13a59077befba31d6679a3af13ecae5185ffe574321da8 libc/src/__support/CPP/type_traits/is_signed.h +2653f581cdf445832dc72705c17369c327764b6cb6796ade2a0edadf35950c83 libc/src/__support/CPP/type_traits/is_trivially_constructible.h +50060eeec4366f16e648bcacf9abff8ea0d0ec089699c6d6e217851f5dc66a4f libc/src/__support/CPP/type_traits/is_trivially_copyable.h +1df8de725bb5dbd8cc6e11e639271a8f7e913073f51c0e134b53b7b9142ba899 libc/src/__support/CPP/type_traits/is_trivially_destructible.h +fb6acc5fb26edf7f5d22bd91463cad0db6c09402d1f3a7089f5758b1350fc276 libc/src/__support/CPP/type_traits/is_union.h +014c7db6d3786fbec3483731cc16cc10e9ec57d66fdb2172b37553113cd1e2dd libc/src/__support/CPP/type_traits/is_unsigned.h +bc64bdc46ec4d650429c8f7a3d782e5809385e8c76c7e2c1f1e6fc3c325d27a5 libc/src/__support/CPP/type_traits/is_void.h +e709c3a504402d84894365aeac63f2697f41388117aaf24e03183efaeb16d8c2 libc/src/__support/CPP/type_traits/make_signed.h +29f471097b205e69b11320c40f58e7411b1160de4815cb9b499fc68bc68b33ea libc/src/__support/CPP/type_traits/make_unsigned.h +4daf6b639b3036f35d2bd8fccf3466901aad767508302831d3f15838371b6789 libc/src/__support/CPP/type_traits/remove_all_extents.h +d2ff553aa2b7107a7ba7c6688bf89177004e6773fbb8e69a58ff2891d5e6675b libc/src/__support/CPP/type_traits/remove_cv.h +dbd0593b8c1b29496690fa9408f049843b62906fcf32831b463c79556e4b9460 libc/src/__support/CPP/type_traits/remove_cvref.h +7ae0793eb6e0daf115424f47b7256e79b810801c1e878018df08fc9067e2265d libc/src/__support/CPP/type_traits/remove_extent.h +995e117692af3b126160c3ea7520e206f6694c35ae5d43d79cc995dbce855cee libc/src/__support/CPP/type_traits/remove_reference.h +a2fa1d166c63b4bb4e8952c8374d0eddbf61f3cff4702ae09fde1b2a2b171b49 libc/src/__support/CPP/type_traits/true_type.h +b2d8ceca585983753db2acb1e96b5fe4e72d5de57f336cfa7e80fe20511ea1c1 libc/src/__support/CPP/type_traits/type_identity.h +f89033a8d0598d1e957fa995289d8303259f27c1445bcaaa0c305ffcca61a066 libc/src/__support/CPP/type_traits/void_t.h +0c9c654c0ca83b8bbb186c1436a5893a919cb3e63d9cf73637401058316c3ea2 libc/src/__support/CPP/utility.h +f3869c2bda6765a7df97abe0ec63ec02616dbbe56df5101675375536279a8f65 libc/src/__support/CPP/utility/declval.h +4289b79740595823b703136e09330a1e86f1a77a1a694a37507fc3a89c67d5f4 libc/src/__support/CPP/utility/forward.h +04b65476915279603fe749c43503e9cbbb03bd0da39a5007e0264529b80d5095 libc/src/__support/CPP/utility/in_place.h +bc84c0ea26a8c7df035900a9454c26d9cbe4d3565fb518864070897020fcfbdf libc/src/__support/CPP/utility/integer_sequence.h +aedb30715e31fe559bb0f2f06c70f1bad2ac012b1fb3ae52737d97eccf4ac01a libc/src/__support/CPP/utility/move.h +52481a7c0318e0d1e89013be819165f5f6291b9e8da42e6ada575c0f8045d0b7 libc/src/__support/FPUtil/FPBits.h +67118e70b91a5b6edf87e6ed3004001373590dba2fd460acdda615a5e8697206 libc/src/__support/FPUtil/rounding_mode.h +ce942fb86b075a6447c1ba9c5bd82b655e388c983ccfaa50573f34ff63bad8a8 libc/src/__support/OSUtil/baremetal/io.h +6b46258908e1ebd8fbf14f8668f0b66354f90d06f708fdfba0eb6b0997229898 libc/src/__support/OSUtil/darwin/aarch64/syscall.h +93db9f8d505c5a42f69789d784e271bcc99daa99cae42de590bb6ffc55da6b1b libc/src/__support/OSUtil/darwin/io.h +c050368ca03d0f64974263ec456a493343eee977c6de97ccb34952e5d8b32257 libc/src/__support/OSUtil/darwin/syscall.h +844d0ecd906f766390c887bf5811e41883748d9a41e5c3a4e58d783e4f818584 libc/src/__support/OSUtil/exit.h +361d0aae318b622fcdf132eb42b2a79769ca4de6380ca26b32291030b88f0c1d libc/src/__support/OSUtil/freebsd/io.h +4b179063ee14302cd2ee9c65904eaf038bace4f7847b46c9175ece8c3b158326 libc/src/__support/OSUtil/freebsd/syscall.h +cc4607392e7417c60d4ab99f1e5750eec0b9b465fdd63bfb18c2a7b8736fe3a7 libc/src/__support/OSUtil/freebsd/syscall_wrappers/write.h +acd9c7f50001ef5a9da35e74776165678bb881acedce00bdb8825f7f7e2250b3 libc/src/__support/OSUtil/freebsd/x86_64/syscall.h +ffb1735e5e3ecdc5aa3d5f7e9e3624fa3ebaaa960bb0a1310f485278961f8dfd libc/src/__support/OSUtil/fuchsia/io.h +3ef5b1e209b3c121bf3ebef0e12b0cfee4281c32d11f73fd094fe97be5fbe996 libc/src/__support/OSUtil/gpu/io.h +3a23dee1d3e0962ed34c246f78e98452e964bbf830739d12974843d1516d9b9d libc/src/__support/OSUtil/io.h +9737c93b6b9a0c60c023d7314e159ba37952b64933626cef963dbffa6d076d20 libc/src/__support/OSUtil/linux/aarch64/syscall.h +ddf06b267d5ce196b45e7aa49e97bf2765e5b31a902dce8822037a438881fdfd libc/src/__support/OSUtil/linux/arm/syscall.h +a165d85eb81c3ae282ee6c48f00432f8c11c3a2d6545db6ddaaa88c147b6004b libc/src/__support/OSUtil/linux/i386/syscall.h +11f02d3d744409176691a4d58f3da299c87e42251ab4e97f589682379b4c845d libc/src/__support/OSUtil/linux/io.h +27739a00c008e855562c7b434840576a1affa13348e8e79c07c3de5d18eec41f libc/src/__support/OSUtil/linux/riscv/syscall.h +a83871271d054420ff8f9ff41229242ebaad631c2eb445233f4c1f967359cf38 libc/src/__support/OSUtil/linux/syscall.h +214ced0c72f81e677a79eddd7eb5c243819879b5e7c5d271700338721d3c9565 libc/src/__support/OSUtil/linux/x86_64/syscall.h +240b00bbd1687293c83e75c35473abe01f3ac1d3d631867d3f16d2a8f406cf1b libc/src/__support/OSUtil/uefi/io.h +f9b654f814bb518fd2b03ddabefd47d9a162ee1554f29ba2ab848d8a7c133638 libc/src/__support/OSUtil/windows/io.h +245ccb9bfd90ce799e5b5841abe7b8197c87254fbc4d51c74e3f07154150d213 libc/src/__support/big_int.h +2e76716a2f9aff1392a85ae70429ea6f9754c58daee0beee6d1b4874be2bbc40 libc/src/__support/common.h +e574528e343e468ab3f2d9c345ee275966e54644fb1b81e2e8552704ce9e4446 libc/src/__support/ctype_utils.h +b9a82a7211ee4e3bfbfc5798b802a3d1f97f4bc9af2fcdf9b4620eb285259036 libc/src/__support/detailed_powers_of_ten.h +fd0256a70a6bb8008198bbf28142edf80bda9183d7302238bc1ebb56129c0f94 libc/src/__support/error_or.h +6b1495e3447c896b20b049a97e6b1269880440801bce0bfbce42021a0f8415dd libc/src/__support/high_precision_decimal.h +906278f0931c794419037732a606b2ff50696e57e79201a06f751a896944d96c libc/src/__support/integer_to_string.h +c83329aaf090185479145db6036d3f3d1e3931ac86b1cb5de62daee7a405ca26 libc/src/__support/libc_assert.h +935cb1c26360a657182bbf3c4f1f4f8eb59ae69af945560e00a0c5d9ce29aaf4 libc/src/__support/macros/attributes.h +df561513523f048e6279c0577c591ee59fc55269c1bc66160f36b1f747a39965 libc/src/__support/macros/config.h +62b1e27d3f3dc09fe8eb98f6f3910325be9ed445e96a51a16545f0e7d0322cfc libc/src/__support/macros/macro-utils.h +fada7446a9e1f171aa55bd371cc9fdf16e07b35a893344cf7c6381ecf2d7827e libc/src/__support/macros/null_check.h +083f82cd1b6b1f67bf7a1f9a392136c8084ac7586c8b150639b35a7a27c584fb libc/src/__support/macros/optimization.h +0398c61ada360db0e908f926cea9d447391ddb700cdab9385f703a5d3e2b3853 libc/src/__support/macros/properties/architectures.h +83fe28dbec8b4e778a1ca5b0db9f134251ddd388e9e9ad4d330145e92e288539 libc/src/__support/macros/properties/compiler.h +65e63f890b0a49aa3484af23ea021f48a4252679b6de199144ff6fea3ebea416 libc/src/__support/macros/properties/complex_types.h +25463c1671926636a760a345549e60eb8049c5876c08d3122f895140aac7fc21 libc/src/__support/macros/properties/cpu_features.h +da82ac476c0ba817f603852e18515d06487fe93af59e067739b35b47dce321f2 libc/src/__support/macros/properties/os.h +e73dc777e0cd1d39188a3a03508ddb9346949c6fff78eefde642de1b8eb43cbb libc/src/__support/macros/properties/types.h +2a39a08493cde458897660d3ba4a11d1005450f9ae8896ccb5c4de83166de27b libc/src/__support/macros/sanitizer.h +917df24b2495b01904b06530d559511be5c6e565b8f8cb0eab14bc4c222be80a libc/src/__support/math_extras.h +e7988e564035464612641dd06020da156aac4b921a094cd0cdd3627e1901cb69 libc/src/__support/number_pair.h +1c598b95ff680a4132fd11f920d0aa51fe8d5bc1d70f546b7b1e72a1a5aeee53 libc/src/__support/sign.h +4eb661a6d1865631feb07b3ec718aacdd57356d828d843e779e88f51ca1e9c5a libc/src/__support/str_to_float.h +6f48ea1b17d1f9e72dae40b2e7174afeb99425a025665d976983efda74d0c789 libc/src/__support/str_to_integer.h +4c7f2914ade660a423f1ff74aef7a8195150f5b03e6d1943818dafde7b21b8a4 libc/src/__support/str_to_num_result.h +c7f7c81017ce5d295a0aa4f2b334be9003d3200eb49040f30e02a87c4bef4d83 libc/src/__support/uint128.h +81bd3562b37dac48ae6ce56f8826d48d731c50c41c3cc17d0259a22125f0bef0 libc/src/__support/wctype/wctype_classification_utils.h +75b6a5c0a8b67469debac413d6406fa8f12cc7f6e4d1704100647a4c97db4d46 libc/src/__support/wctype/wctype_conversion_utils.h +fd01422e152334ab36697f69ed73b1da1f08c4b1df06a2cb221c4bc8ee7d80c4 libc/src/__support/wctype_utils.h +32d0eded6a24dcf1e5d4968e7a8e9902b459084bbe08d681dc14bf093ce53f9a libcxx/src/algorithm.cpp +b4bca23d2e7a0bac28b3c4c92b0e847d5181a87b064c202ca8e957a2e1160efd libcxx/src/any.cpp +4df71c7151607eea773de422e737710a96288f15082c12ba8761990dec6c8ac4 libcxx/src/atomic.cpp +3e3d7c363419368ac331a8fb4673358588d3a9e588d53dee51da2a2323a21ca3 libcxx/src/barrier.cpp +caba738eeaa4d08d5db0372bea32133b1c02b307b7f9578b6b7ffa860b6a08f2 libcxx/src/bind.cpp +0b736a909e2f73fb6fcb1d39118addcc46eeff43dbdcce800d130f92608ec02b libcxx/src/call_once.cpp +8df06f6d6e25c69671fc00c63bf7dc00c724652fb8629ef4445289abc5b64c66 libcxx/src/charconv.cpp +9477113d06f60387e4a9991c980f9267d623e0fe4573f011030f4f1109c00818 libcxx/src/chrono.cpp +03df5016aa771c0f0b18a749fd2b6d4414a815e296632b98a0c23bd31492160e libcxx/src/chrono_system_time_init.h +60f9ac564007c3b0b2e6d667fc5d72990f6ba79eed6d199600930a86291a0be5 libcxx/src/condition_variable.cpp +e168226c3aee38eba3be75167f62a68b301b94119ddf0367c05c46dac2503117 libcxx/src/condition_variable_destructor.cpp +6472554f3211ec126b43842949fe698d3c12a8669955d1582ad220de80e4bd06 libcxx/src/error_category.cpp +12de42099ce0f312bca06cf693b04388ede3bc67decc6f9b2bd16489b1de6e70 libcxx/src/exception.cpp +31d078ca4c1aa52cb2b7e62697db01658cd2d8273985930f898bfb71608f7194 libcxx/src/filesystem/directory_entry.cpp +1c1db855e0ac6081eedac45f924e4950a919f9346cfc58428f2fea07b8dcc8f7 libcxx/src/filesystem/directory_iterator.cpp +aaa94c31e18c0dbc7b9a461e727592fa229dc66bfabe156b66e6c5d457076b30 libcxx/src/filesystem/error.h +6d6aca69879eb18ae93a6b3fced823c8184fab0c031ebfe0bb887bd33491fd59 libcxx/src/filesystem/file_descriptor.h +bd843c1d5722e457c63cadbc3ee36c123cce5449c401e039e7cd8d7d8103b138 libcxx/src/filesystem/filesystem_clock.cpp +bc19bb7cb03024ede499a24d4635f25ae2baebd8aa009d9e65eeef14c2aa1411 libcxx/src/filesystem/filesystem_error.cpp +3785aef670597f4c8502f7be3b152e9968a5df597b1f810caf6607fb68c6cd78 libcxx/src/filesystem/format_string.h +cb47afadbfc1b2ccc3e454b553e6cc02557145b4b9ec8b9bebc429a1cdc46723 libcxx/src/filesystem/operations.cpp +e80245f8f90b302651ef1bc58cedae341795504df86af43a6e8deabc01cb672c libcxx/src/filesystem/path.cpp +78d878551d487d40ba91dd931efafd25ceab1bd41ad6a7c26cd62f5d8048fe8e libcxx/src/filesystem/path_parser.h +98d04aa7bbaad33100e4a44905e6d8dd8233d21055c7e854c78a262230d09ba8 libcxx/src/filesystem/posix_compat.h +b264875005a9a897e6b547d579959e7c9e808528dc3841efd9ffaaf488a4bf0d libcxx/src/filesystem/time_utils.h +2b283558da7d4e2e32db8fb3fef9e0c20ad259182cc72561cf318f9d6557b5d8 libcxx/src/functional.cpp +67ed09a7a89fb5f9581607380ac8f892481e323c0288c0a8662eac493867c494 libcxx/src/future.cpp +64fe9dbf9de0c6139db3063f8d144adee8806ebe1ffcb8729c224de66a7e4d30 libcxx/src/hash.cpp +c4eefdd38eb927c74c19535f7a80fe7d0097ba99614433fae21c4436484e53e6 libcxx/src/include/aligned_alloc.h +c01d71b5a8fe48773f3670166030284b1050413e22f24bf21bb8c64637036f9e libcxx/src/include/atomic_support.h +5954265d6afa068330beadd159eaa6a4821398a8c20fa4c3ae7886fe5e9cc155 libcxx/src/include/config_elast.h +2066185ea25598a4a0aca98efb7a43cf396d6cd160af06ab507df4e21721ca81 libcxx/src/include/from_chars_floating_point.h +07ca2a6d43a2f601e6710812ad4f467dd8a3ee7634d9c495f5fba61ccb6e23e0 libcxx/src/include/overridable_function.h +8051168ed2c4e4fd0ecb921ad90b15422b62f0c66678c11f9acf90940736f8d4 libcxx/src/include/refstring.h +5d0df36eb16d08610f226cc206fe1dcabbfe23bde33a481068381312401baed3 libcxx/src/include/ryu/common.h +eb44884fccbbfc39e21d9744fae1edc7f2cd2f1a2c59dacf2ac81cf4d62f6a3f libcxx/src/include/ryu/d2fixed.h +b68007164e979c0cca68b19f52057065b412395d819c9900810e1729f1991726 libcxx/src/include/ryu/d2fixed_full_table.h +46fad5fe88cd9a9986ed4a9c8bad0c302b4f3076cebd731bad14fa4a7714a566 libcxx/src/include/ryu/d2s.h +50206d8a5d1d9f05f0041a79f450490e88251961dd8c0df93106cbf67f4fae96 libcxx/src/include/ryu/d2s_full_table.h +5fdbfa56dfeb2fd5f445111bf6cb9cc5410e309220043fdc8c8f20450b27f3bb libcxx/src/include/ryu/d2s_intrinsics.h +b9e50c0b5506de9d104fbae85272bf9e3b1987df840d3ece5d566c5921e76ec2 libcxx/src/include/ryu/digit_table.h +0685f0962c4121afa0f99603484d73dfccbadc54348fe8919d87f6242107471b libcxx/src/include/ryu/f2s.h +f2ee014117048b62d243898821b75d37f65a59688d3c929734632a147f2dba6f libcxx/src/include/ryu/ryu.h +f529f1440e67b2ec9519ccc66f45f0efe445e880a34f95705e17ef731e0b6590 libcxx/src/include/sso_allocator.h +16b3b4882654a6f0ef6a450bd158eb32720b8586f1cbcaafa06e84765bbda601 libcxx/src/include/to_chars_floating_point.h +8acc5f7db079370d685e42df9fcbe6e54d4410c3c0f19b3ec41ab364c507c247 libcxx/src/ios.cpp +056091dc3a95f5e6a978fb7c0f4f41dce9affe9d84de16597cc90a008a73f597 libcxx/src/ios.instantiations.cpp +b12a0df10a4f2f937b1634bfe6b80e31ffd3c7fdd2e83006c2c805a79cd378a8 libcxx/src/iostream.cpp +848284929a6b6d8ce59f5327965eeaf5c43211cc50d17c13c0754c171757ca3e libcxx/src/iostream_init.h +2f563ab7d4cfe284d3e21cfc7adc0c954216ee8a0cd6022d3cb6551303e2e549 libcxx/src/locale.cpp +846473486665736ef5f3affeba7eb669aa7e31602675cbed5aa72f26744320f2 libcxx/src/memory.cpp +e458015dc1dd19969bc811b2865b7c5d7ea36f4a345cd7b232bb8343299caef4 libcxx/src/mutex.cpp +b3df9d6ce47baa0901227a8c1d6761c2979481c8843b5f375605d62c5c12f389 libcxx/src/mutex_destructor.cpp +02a717d9c8389b4932e665d754d69adcde1d55c63fdfd791b590a30622b84984 libcxx/src/new.cpp +0b17697b569d4a4cc9b3c2f97ef69fdf8d6cac72de9871489456c5d9235b1bbf libcxx/src/new_handler.cpp +82b6b57506edc48dcbb13eaa5bf533e680167f983a2a2cf85064c003cb8cdb38 libcxx/src/new_helpers.cpp +e3bbad66e18159bda63433bbc1470fe772e2f924103aff7be2b53f78533f72e1 libcxx/src/optional.cpp +d8f2f3789a7f0ca7282782bc6551008a7c5bfb519ae35b30906a6a6fd0a51d08 libcxx/src/random.cpp +c05f288b5234ff6b9db0983f87648acbeaa46a00eb064739068b851ade7f13e9 libcxx/src/random_shuffle.cpp +756e18bae5e37bc7385fb79240e2d4eb8597694f911e6760b3b321ce2a9c3bd0 libcxx/src/regex.cpp +e182d7b5a2cc2a59d25955cb41319ed8ec22ae43acc4434d04e82295a03d4fae libcxx/src/ryu/d2fixed.cpp +a2c7c814c5a5d98a60643ba7b107084189f7181f66da45177f4e56c0f8ffe6af libcxx/src/ryu/d2s.cpp +6b20f690d560361141cc99032e40bf6be39b3e46b11c169fc0a2f478135a119b libcxx/src/ryu/f2s.cpp +aed355371e37deb408d6d59195670b2b7c8368ae2af54192e8d77e470e66b4a4 libcxx/src/shared_mutex.cpp +852fcbb090e5729367c1f441a801dbe7351070aecd9e5aa1bb0ff3a151cc3cd6 libcxx/src/std_stream.h +1ebd64bc015d00799f6373d9b1a47a57e95143a06bbd7e488c7c866d970e4872 libcxx/src/stdexcept.cpp +af151f35ae29b36abb7e7a8d8ca0518e5cf3629a7e09866b3b7fd1a30d8b8a0e libcxx/src/string.cpp +ef1f0e29848addb728eb51d3866124929c6f445efb6f2bac723cff25ddd8385a libcxx/src/strstream.cpp +d34d46698e00a17ed3865bbd2c24b0e5f4e27509a993a3d93d5736df1957321d libcxx/src/support/runtime/exception_fallback.ipp +fc115fb87f67cce2d758a3c2517ccf77ee5bfc41d9a7436667ecfc68626a8aaa libcxx/src/support/runtime/exception_glibcxx.ipp +4af2f8818ec6e5c38c167f76ec711e6a2f0dcab9c98e6980fc3a6139bd2a4a54 libcxx/src/support/runtime/exception_libcxxabi.ipp +479eee0a4ab27dadfdeec523b0a71eaba9d45e142e8d79e1699986614a50e2b9 libcxx/src/support/runtime/exception_libcxxrt.ipp +fb9e6f3d3984b8897c3b19520ef6ecfaf5a026307eb7c920a270d6ddf0e3ff3c libcxx/src/support/runtime/exception_msvc.ipp +9513c028546b5f1ac3a415a299a7c4a3381fbcd8dd72ae453bc07feb80e399f5 libcxx/src/support/runtime/exception_pointer_cxxabi.ipp +b5228c020de13468e1b9f15014db9a33fbed57e8df7ec1e08e36d1a53a0d5df5 libcxx/src/support/runtime/exception_pointer_glibcxx.ipp +bde28ba69f6687d030d090ebfab5f32857df16642c88ca90518ca7388bfb7b80 libcxx/src/support/runtime/exception_pointer_msvc.ipp +6a860182699b87b6f523ea1a74d4b166835928c5498ba10934b8364e8b940171 libcxx/src/support/runtime/exception_pointer_unimplemented.ipp +4f4a99af12f8a6c2d6eeb9894ebd9c4ee524feb3932766251ceced008d2eefc5 libcxx/src/support/runtime/stdexcept_default.ipp +dacc2afe2df26d3f4d78ad7849c9817a8a41a05553d79665eae6de3e1d9dd1b4 libcxx/src/support/runtime/stdexcept_vcruntime.ipp +8e14d2521c70bc1a857fa6e41cd929b44a102a234bfb863e90f05ea0dc86d512 libcxx/src/system_error.cpp +d5f2b5f32a8a2e2ce407f674f0be63fee6be23de2351e1a26aa83d66a3069a02 libcxx/src/thread.cpp +484f7fe899ac0c9101b0b9cc2d320030a4f72aa3ced68131071858722bdfd6c6 libcxx/src/typeinfo.cpp +b4fc1f801d4eab83057b4b7b8638c9192ceaec3b17388f7cf4d6d104e0c790fc libcxx/src/valarray.cpp +1409f5559f84668a585b0cedb83d854dc3802dfeb03eefb184bf6f0735e19c90 libcxx/src/variant.cpp +bc71e80b498ff828e6bf91f1715c40af40cf52e7f7a1e3f3a8c9a1c6fcd56647 libcxx/src/vector.cpp +68d3be1acfd845388ff0b6da6f45c8ef23fb4ea8893c6b0959d73dd6192a7f5b libcxx/src/verbose_abort.cpp +93b1415fedb1c74486e888446c17b0a65bb93f26d74fc2f6329734e94e735ee7 libcxxabi/src/abort_message.cpp +a5d95a89ae7013a171d3f7688f70f7b71e870ff85f2144c250782c399cff20de libcxxabi/src/abort_message.h +c7d1a49b267e6b13e48e2a7e80d273aceba1dded60d4185e55ff74eb92b70c31 libcxxabi/src/aix_state_tab_eh.inc +05fb65ba6f3c4f559b994a6f98709ee14075756fd354ebed66d728c926c44c8f libcxxabi/src/cxa_aux_runtime.cpp +ada97c5adba6b8a798c2ac4585284cb1c870f9fa49f49d0aed87678f56423894 libcxxabi/src/cxa_default_handlers.cpp +2693c9d841b50fa60a5d92b265d59faa32e675de7c947b6c0e6f3ed62551188f libcxxabi/src/cxa_demangle.cpp +5eb32b905476f6b1de87f8be335f18853fd56bedac20df74b16799e813f3c61c libcxxabi/src/cxa_exception.cpp +f6867fd35fc8bafde2f9348a017a2ca9938f577d648d7258d9aef780064ddb52 libcxxabi/src/cxa_exception.h +7de17cefbedbf94d7282fe3cde0e23e592b90c1d5e50db5d63009d7cfc877721 libcxxabi/src/cxa_exception_storage.cpp +97dbc2a48acb2233301bd7c11717cda173b23c73e7da64eb1710332c3b19f54d libcxxabi/src/cxa_guard.cpp +0c77f1e80dd8115e7fae1674e7c539b239b72b2b9552b79aaab68fd454d82f6d libcxxabi/src/cxa_guard_impl.h +86e73cfc5bf2216166e4984549507bbe3a0e9643690a5425fff1fbfd483b7f3f libcxxabi/src/cxa_handlers.cpp +2c87e313acb5a9e8a48374cd431da69c98fb2c9ad2c70be82fe7fbed122d00fe libcxxabi/src/cxa_handlers.h +d2f6f9f754aeda4158084a01f0d0b65de6ff11518dfd3d34c0b6725f9927f248 libcxxabi/src/cxa_personality.cpp +4bd45f3f5027b7d4d682fa1a6c8430298cf988b829f3a38b190618fca4c07fb1 libcxxabi/src/cxa_thread_atexit.cpp +c34ef4c79f84ff6c859270399324e2b2252275f73b8014ed471ce698c3714f07 libcxxabi/src/cxa_vector.cpp +0862e2a61238ea37d8aea2d5ebb21664df4217b3658f5a81c61813b6ed673949 libcxxabi/src/cxa_virtual.cpp +f22aa8086101d74d1c21fa2f147cf85972f35a81ddd79647aebbd5704e6e820d libcxxabi/src/demangle/DemangleConfig.h +deec98d3e067ae280f65165c413ed526ea5196fdd30550c0f47e1853e3adcbca libcxxabi/src/demangle/ItaniumDemangle.h +488f572cae0ecbb8961f9d408d2aebf5b200fc7b7b145604848e4c363265d63a libcxxabi/src/demangle/ItaniumNodes.def +3e2bef93ff590dcc156d7392b7f0b507a2a21559fee8a15e24a85d100e30bb02 libcxxabi/src/demangle/StringViewExtras.h +ec7a3ea0fae8b00c39068a35a1fea1bc66fd4a1f7c16d5214909d57e733dec52 libcxxabi/src/demangle/Utility.h +561b22a242cb96f40d80f77ecb216050bf434c24a8af8fc27e8ee61111497741 libcxxabi/src/fallback_malloc.cpp +a9f725ecf2bfe34f482ead34e182b74013e48fc51902f55eba2a7e30866415b1 libcxxabi/src/fallback_malloc.h +25cad568b55d0d3e82354ebc9c27f5f80d8d737cfdea9ffadf1f843a877d899c libcxxabi/src/private_typeinfo.cpp +308dd443446dfa0e6972e897f575c4e379f50bbf3aee3f5126f955f44768c803 libcxxabi/src/private_typeinfo.h +d609597f8f536fec59f7afa2dbd352c69a9b50ce8aaf85082fd1fbad08c79a25 libcxxabi/src/stdlib_exception.cpp +8539fc8929cd9a166a74fe04ef81472e7a6d507f4422f991963867fbda1f256a libcxxabi/src/stdlib_stdexcept.cpp +5d0b584b9341eb49ea5e640a475dc690d44b0770712222e2667185b1e814367f libcxxabi/src/stdlib_typeinfo.cpp diff --git a/cmake/libcxx/update.py b/cmake/libcxx/update.py index 53761d4..0329005 100644 --- a/cmake/libcxx/update.py +++ b/cmake/libcxx/update.py @@ -1,93 +1,186 @@ -"""Regenerates the libc++ pins used by Linux builds (maintainer tool, needs the `gh` CLI). +"""Regenerates the libc++ pins used by Linux builds (maintainer tool, needs `git` and the `gh` CLI). The Linux libwebrtc prebuilt ships only the *.h headers of Chromium's libc++. This script -- finds the llvm-project commit whose libcxx/include matches them byte for byte and writes the SHA256 of - every remaining (extensionless) header to headers.sha256; +- resolves the libc++, libc++abi and llvm-libc revisions of WebRTC's DEPS to llvm-project commits, and checks + that the prebuilt's *.h headers match the libc++ one byte for byte; +- writes the SHA256 of every remaining (extensionless) libc++ header to headers.sha256; - writes the SHA256 of Chromium's build-generated libc++ config (__config_site, __assertion_handler) - at the given Chromium tag to config.sha256. -Then set LIBCXX_LLVM_COMMIT and LIBCXX_CHROMIUM_TAG in cmake/libwebrtc.cmake to the printed values. + at the given Chromium tag to config.sha256; +- writes the SHA256 of the libc++ and libc++abi sources Chromium builds, plus every file they include, to + runtime.sha256 (the linux-arm64 prebuilt lacks the compiled runtime). +Then set the printed variables in cmake/libwebrtc.cmake. usage: python cmake/libcxx/update.py /include/third_party/libc++/src/include \\ - --chromium-tag 152.0.7977.0 --since 2026-04-01 --until 2026-06-01 + --webrtc-branch 7977 --chromium-tag 152.0.7977.0 """ import argparse import base64 +import datetime import hashlib import json +import posixpath +import re import subprocess +import tempfile from concurrent.futures import ThreadPoolExecutor from pathlib import Path +from typing import Any, Dict, List, Set REPO = 'repos/llvm/llvm-project' CHROMIUM_CONFIG = ('__config_site', '__assertion_handler') - - -def gh(path): +# llvm-project dir -> (its DEPS path in WebRTC, CMake variable of its commit) +LLVM_DIRS = { + 'libcxx': ('src/third_party/libc++/src', 'LIBCXX_LLVM_COMMIT'), + 'libcxxabi': ('src/third_party/libc++abi/src', 'LIBCXXABI_LLVM_COMMIT'), + 'libc': ('src/third_party/llvm-libc/src', 'LLVM_LIBC_COMMIT'), +} +# llvm-project dirs the runtime sources include from: their own trees, and llvm-libc (-I libc) +RUNTIME_TREES = ('libcxx/src', 'libcxxabi/src', 'libc') +INCLUDE = re.compile(rb'^\s*#\s*include\s*[<"]([^>"]+)[>"]', re.MULTILINE) + + +def gh(path: str) -> Any: return json.loads(subprocess.check_output(['gh', 'api', path])) -def blob_sha(data): +def blob_sha(data: bytes) -> str: return hashlib.sha1(b'blob %d\0' % len(data) + data).hexdigest() -def include_tree(commit): - tree = gh(f'{REPO}/git/commits/{commit}')['tree']['sha'] - for part in ('libcxx', 'include'): +def tree_sha(commit: str, path: str) -> str: + tree: str = gh(f'{REPO}/git/commits/{commit}')['tree']['sha'] + for part in path.split('/'): tree = next(e['sha'] for e in gh(f'{REPO}/git/trees/{tree}')['tree'] if e['path'] == part) - return [e for e in gh(f'{REPO}/git/trees/{tree}?recursive=1')['tree'] if e['type'] == 'blob'] - - -def main(): + return tree + + +def subtree(commit: str, path: str) -> List[Dict[str, Any]]: + listing = gh(f'{REPO}/git/trees/{tree_sha(commit, path)}?recursive=1') + if listing['truncated']: + raise SystemExit(f'{path} tree listing is truncated') + return [e for e in listing['tree'] if e['type'] == 'blob'] + + +def blob(sha: str) -> bytes: + return base64.b64decode(gh(f'{REPO}/git/blobs/{sha}')['content']) + + +def chromium(path: str, tag: str) -> bytes: + return subprocess.check_output( + ['gh', 'api', '-H', 'Accept: application/vnd.github.raw', f'repos/chromium/chromium/contents/{path}?ref={tag}'] + ) + + +def git_fetch(url: str, ref: str, repo: str) -> str: + """Fetches only the commit object of , returns its hash.""" + subprocess.run(['git', 'init', '-q', repo], check=True) + subprocess.run(['git', '-C', repo, 'fetch', '-q', '--depth=1', '--filter=tree:0', url, ref], check=True) + return subprocess.check_output(['git', '-C', repo, 'rev-parse', 'FETCH_HEAD'], text=True).strip() + + +def resolve_llvm(deps: str, name: str) -> str: + """Chromium mirrors each llvm-project dir as its own repo: finds the llvm-project commit with the same tree.""" + match = re.search(rf"'{re.escape(LLVM_DIRS[name][0])}':\s*'([^'@]+)@([0-9a-f]+)'", deps) + if not match: + raise SystemExit(f'{LLVM_DIRS[name][0]} is not in the WebRTC DEPS') + url, revision = match.groups() + with tempfile.TemporaryDirectory() as repo: + git_fetch(url, revision, repo) + tree, committed = subprocess.check_output( + ['git', '-C', repo, 'log', '-1', '--format=%T %cI', 'FETCH_HEAD'], text=True + ).split() + date = datetime.datetime.fromisoformat(committed).astimezone(datetime.timezone.utc) + since, until = ((date + datetime.timedelta(days=d)).strftime('%Y-%m-%dT%H:%M:%SZ') for d in (-1, 1)) + for commit in gh(f'{REPO}/commits?path={name}&since={since}&until={until}&per_page=100'): + if tree_sha(commit['sha'], name) == tree: + return str(commit['sha']) + raise SystemExit(f'no llvm-project commit has the {name} tree of {url}@{revision}') + + +def runtime_sources(tag: str) -> List[str]: + """The libc++ and libc++abi sources of Chromium's Linux build, as llvm-project paths.""" + sources = [] + for gn, llvm in (('libc%2B%2B', 'libcxx'), ('libc%2B%2Babi', 'libcxxabi')): + for line in chromium(f'buildtools/third_party/{gn}/BUILD.gn', tag).decode().splitlines(): + match = re.search(r'"//third_party/libc\+\+(?:abi)?/src/src/([^"]+\.cpp)"', line) + if match and not line.lstrip().startswith('#') and 'win32' not in match[1]: + sources.append(f'{llvm}/src/{match[1]}') + return sorted(set(sources)) + + +def pin_runtime(commits: Dict[str, str], tag: str) -> None: + """Pins the runtime sources and, transitively, every file they include from RUNTIME_TREES.""" + tree: Dict[str, str] = {} + for root in RUNTIME_TREES: + tree.update({f'{root}/{e["path"]}': e['sha'] for e in subtree(commits[root.split('/')[0]], root)}) + sources = runtime_sources(tag) + pinned: Dict[str, bytes] = {} + queue = list(sources) + with ThreadPoolExecutor(8) as pool: + while queue: + for path, data in zip(queue, pool.map(blob, [tree[p] for p in queue])): + pinned[path] = data + found: Set[str] = set() + for path in queue: + for include in INCLUDE.findall(pinned[path]): + name = include.decode() + candidates = [posixpath.normpath(posixpath.join(posixpath.dirname(path), name))] + candidates += [f'{root}/{name}' for root in ('libcxx/src', 'libc')] + found.update(c for c in candidates if c in tree and c not in pinned) + queue = sorted(found) + # CMake compiles every pinned libcxx/libcxxabi .cpp, so only the sources may be among them + stray = [p for p in pinned if p.endswith('.cpp') and p not in sources and not p.startswith('libc/')] + if stray: + raise SystemExit(f'sources include other .cpp files: {stray}') + lines = [f'{hashlib.sha256(data).hexdigest()} {path}\n' for path, data in sorted(pinned.items())] + (Path(__file__).parent / 'runtime.sha256').write_text(''.join(lines)) + print(f'{len(sources)} runtime sources, {len(lines)} files pinned') + + +def main() -> None: parser = argparse.ArgumentParser() parser.add_argument('headers', type=Path, help='libc++ include dir of the unpacked Linux prebuilt') + parser.add_argument('--webrtc-branch', required=True, help='WebRTC branch number of the prebuilt, e.g. 7977') parser.add_argument('--chromium-tag', required=True, help='Chromium tag matching the WebRTC branch') - parser.add_argument('--since', required=True, help='search window start, YYYY-MM-DD') - parser.add_argument('--until', required=True, help='search window end, YYYY-MM-DD') args = parser.parse_args() - local = {str(p.relative_to(args.headers)): blob_sha(p.read_bytes()) for p in args.headers.rglob('*') if p.is_file()} + with tempfile.TemporaryDirectory() as repo: + webrtc = git_fetch('https://webrtc.googlesource.com/src', f'refs/branch-heads/{args.webrtc_branch}', repo) + deps = subprocess.check_output(['git', '-C', repo, 'show', 'FETCH_HEAD:DEPS'], text=True) + print(f'WebRTC branch-heads/{args.webrtc_branch} at {webrtc}') + commits = {name: resolve_llvm(deps, name) for name in LLVM_DIRS} - commits = subprocess.check_output( - [ - 'gh', 'api', '--paginate', '--jq', '.[].sha', - f'{REPO}/commits?path=libcxx/include&since={args.since}T00:00:00Z&until={args.until}T00:00:00Z', - ], - text=True, - ).split() # fmt: skip - - for commit in commits: - tree = include_tree(commit) - remote = {e['path']: e['sha'] for e in tree} - mismatches = sum(remote.get(path) != sha for path, sha in local.items()) - print(commit, mismatches, flush=True) - if not mismatches: - break - else: - raise SystemExit('no matching commit in the window, widen it') + tree = subtree(commits['libcxx'], 'libcxx/include') + remote = {e['path']: e['sha'] for e in tree} + local = {str(p.relative_to(args.headers)): blob_sha(p.read_bytes()) for p in args.headers.rglob('*') if p.is_file()} + mismatches = [path for path, sha in local.items() if remote.get(path) != sha] + if mismatches: + raise SystemExit(f'the prebuilt headers differ from llvm-project@{commits["libcxx"]}: {mismatches[:10]}') missing = [e for e in tree if e['path'] not in local and '.' not in e['path'].rsplit('/', 1)[-1]] - def sha256(entry): - data = base64.b64decode(gh(f'{REPO}/git/blobs/{entry["sha"]}')['content']) + def sha256(entry: Dict[str, Any]) -> str: + data = blob(entry['sha']) return f'{hashlib.sha256(data).hexdigest()} {entry["path"]}\n' with ThreadPoolExecutor(8) as pool: lines = sorted(pool.map(sha256, missing), key=lambda line: line.split()[1]) (Path(__file__).parent / 'headers.sha256').write_text(''.join(lines)) - print(f'LIBCXX_LLVM_COMMIT {commit}: {len(lines)} headers pinned') + print(f'{len(lines)} headers pinned') config = [] for name in CHROMIUM_CONFIG: - data = subprocess.check_output( - [ - 'gh', 'api', '-H', 'Accept: application/vnd.github.raw', - f'repos/chromium/chromium/contents/buildtools/third_party/libc%2B%2B/{name}?ref={args.chromium_tag}', - ] - ) # fmt: skip + data = chromium(f'buildtools/third_party/libc%2B%2B/{name}', args.chromium_tag) config.append(f'{hashlib.sha256(data).hexdigest()} {name}\n') (Path(__file__).parent / 'config.sha256').write_text(''.join(config)) - print(f'LIBCXX_CHROMIUM_TAG {args.chromium_tag}: {len(config)} config headers pinned') + print(f'{len(config)} config headers pinned') + + pin_runtime(commits, args.chromium_tag) + + for name, (_, variable) in LLVM_DIRS.items(): + print(f'set({variable} {commits[name]})') + print(f'set(LIBCXX_CHROMIUM_TAG {args.chromium_tag})') if __name__ == '__main__': diff --git a/cmake/libwebrtc.cmake b/cmake/libwebrtc.cmake index 3d39492..ec9be07 100644 --- a/cmake/libwebrtc.cmake +++ b/cmake/libwebrtc.cmake @@ -13,8 +13,8 @@ set(LIBWEBRTC_VERSION "152.7977.0.0") set(LIBWEBRTC_URL_BASE "https://github.com/crow-misia/libwebrtc-bin/releases/download/${LIBWEBRTC_VERSION}") -# linux-arm64 is not listed: its archive lacks most of libc++ and libc++abi. set(LIBWEBRTC_SHA256_linux-x64 5ba9bbb3392671d96f8fb300e2a2c1566d76fa4e590e3b4f959fa144da16da5c) +set(LIBWEBRTC_SHA256_linux-arm64 11b84989ee3ca7fb75ff5041bf5aab5fda8934da02d1705891e1adc9c75f1ba4) set(LIBWEBRTC_SHA256_macos-x64 1d4f4480316e227fa026bb928c31c3fc2fcc0e8c65f85323c314e1be4ac55b14) set(LIBWEBRTC_SHA256_macos-arm64 3a7d3d7d10de56580d3cbe18910a92c3ab85ae07316e6f745890c7b545c0a9c7) set(LIBWEBRTC_SHA256_win-x64 41e64b712f3777db0377e8445972051366bc333905b0880a1fc6c4bef1f5b8cf) @@ -23,23 +23,42 @@ set(LIBWEBRTC_SHA256_win-x86 44cb24862b8deb5cbeef697d1e84bdb5a93ec416602aafa # The Linux prebuilts are compiled against Chromium's libc++ but only ship its *.h # headers. The extensionless ones are fetched from the matching llvm-project commit # (see cmake/libcxx/README.md). Its build-generated config comes from the matching Chromium tag. -set(LIBCXX_LLVM_COMMIT fe2138d9ec791069edf8183a962711c96db55e3f) +# The linux-arm64 prebuilt also lacks the compiled libc++ and libc++abi, which are built from the +# llvm-project commits WebRTC pins them (and llvm-libc, which libc++ uses) at. +set(LIBCXX_LLVM_COMMIT 54359956733059b058c071264ad58a6ddbed4976) +set(LIBCXXABI_LLVM_COMMIT 4ffd373e3853ebc00fb339611e215deab682a54c) +set(LLVM_LIBC_COMMIT 2abc19543d802780eadd1450f0aa0c28fed080af) set(LIBCXX_CHROMIUM_TAG 152.0.7977.0) -# Downloads every " " entry of a manifest from / into /. +# Downloads every " " entry of a manifest from / into /, +# optionally only the paths starting with . function(_fetch_pinned manifest base_url dest) - file(STRINGS "${manifest}" _lines) + if(ARGC GREATER 3) + file(STRINGS "${manifest}" _lines REGEX " ${ARGV3}") + else() + file(STRINGS "${manifest}" _lines) + endif() foreach(_line IN LISTS _lines) string(REGEX MATCH "^([0-9a-f]+) (.+)$" _ "${_line}") - file(DOWNLOAD "${base_url}/${CMAKE_MATCH_2}" "${dest}/${CMAKE_MATCH_2}" - EXPECTED_HASH SHA256=${CMAKE_MATCH_1} - STATUS _status - TLS_VERIFY ON - ) - list(GET _status 0 _code) - if(NOT _code EQUAL 0) - message(FATAL_ERROR "Failed to download ${base_url}/${CMAKE_MATCH_2}: ${_status}") - endif() + set(_sha "${CMAKE_MATCH_1}") + set(_path "${CMAKE_MATCH_2}") + # raw.githubusercontent.com fails now and then over hundreds of requests, so retry; + # no EXPECTED_HASH, it turns a failed attempt into a configure error + foreach(_attempt RANGE 1 4) + file(DOWNLOAD "${base_url}/${_path}" "${dest}/${_path}" STATUS _status TLS_VERIFY ON) + list(GET _status 0 _code) + if(_code EQUAL 0) + file(SHA256 "${dest}/${_path}" _actual) + if(_actual STREQUAL _sha) + break() + endif() + set(_status "SHA256 mismatch: ${_actual}") + endif() + if(_attempt EQUAL 4) + message(FATAL_ERROR "Failed to download ${base_url}/${_path}: ${_status}") + endif() + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep ${_attempt}) + endforeach() endforeach() endfunction() @@ -87,6 +106,7 @@ set(LIBWEBRTC_PLATFORM "${_os}-${_arch}") if(NOT DEFINED LIBWEBRTC_SHA256_${LIBWEBRTC_PLATFORM}) message(FATAL_ERROR "No prebuilt libwebrtc for ${LIBWEBRTC_PLATFORM}") endif() +set(_build_libcxx OFF) # --- download & unpack ------------------------------------------------------- @@ -112,6 +132,11 @@ if(NOT LIBWEBRTC_ROOT) file(SHA256 "${CMAKE_CURRENT_LIST_DIR}/libcxx/config.sha256" _config_hash) string(APPEND _stamp_content ";${LIBCXX_LLVM_COMMIT};${_headers_hash};${LIBCXX_CHROMIUM_TAG};${_config_hash}") endif() + if(LIBWEBRTC_PLATFORM STREQUAL "linux-arm64") + set(_build_libcxx ON) + file(SHA256 "${CMAKE_CURRENT_LIST_DIR}/libcxx/runtime.sha256" _runtime_hash) + string(APPEND _stamp_content ";${LIBCXXABI_LLVM_COMMIT};${LLVM_LIBC_COMMIT};${_runtime_hash}") + endif() set(_stamp_current "") if(EXISTS "${_stamp}") file(READ "${_stamp}" _stamp_current) @@ -161,6 +186,16 @@ if(NOT LIBWEBRTC_ROOT) "https://raw.githubusercontent.com/chromium/chromium/${LIBCXX_CHROMIUM_TAG}/buildtools/third_party/libc++" "${LIBWEBRTC_ROOT}/include/buildtools/third_party/libc++") endif() + if(_build_libcxx) + message(STATUS "Downloading libc++, libc++abi and llvm-libc sources") + foreach(_dir_commit libcxx/${LIBCXX_LLVM_COMMIT} libcxxabi/${LIBCXXABI_LLVM_COMMIT} libc/${LLVM_LIBC_COMMIT}) + string(REPLACE "/" ";" _dir_commit "${_dir_commit}") + list(GET _dir_commit 0 _dir) + list(GET _dir_commit 1 _commit) + _fetch_pinned("${CMAKE_CURRENT_LIST_DIR}/libcxx/runtime.sha256" + "https://raw.githubusercontent.com/llvm/llvm-project/${_commit}" "${LIBWEBRTC_ROOT}/llvm" "${_dir}/") + endforeach() + endif() if(WIN32) file(RENAME "${LIBWEBRTC_ROOT}/release" "${LIBWEBRTC_ROOT}/lib") @@ -225,21 +260,57 @@ elseif(_os STREQUAL "linux") "libwebrtc for Linux is built against Chromium's libc++, which requires Clang. " "Set CXX=clang++ (and CC=clang).") endif() - target_compile_definitions(libwebrtc INTERFACE - WEBRTC_LINUX - _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE - ) - # Use the bundled libc++ (namespace std::__Cr) instead of the system libstdc++; - # its implementation is part of libwebrtc.a. - target_compile_options(libwebrtc INTERFACE + set(_libcxx_defines _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE) + set(_libcxx_options $<$:-nostdinc++> "SHELL:-isystem ${_inc}/buildtools/third_party/libc++" "SHELL:-isystem ${_inc}/third_party/libc++/src/include" "SHELL:-isystem ${_inc}/third_party/libc++abi/src/include" ) + target_compile_definitions(libwebrtc INTERFACE WEBRTC_LINUX ${_libcxx_defines}) + # Use the bundled libc++ (namespace std::__Cr) instead of the system libstdc++; + # its implementation is part of libwebrtc.a (built below on arm64). + target_compile_options(libwebrtc INTERFACE ${_libcxx_options}) # BIND_NOW: an incomplete prebuilt must fail on import, not on the first call target_link_options(libwebrtc INTERFACE -nostdlib++ "LINKER:--exclude-libs,ALL" "LINKER:-z,now") # Declared by a libwebrtc-bin Linux patch, but their definitions are missing from the archive target_sources(libwebrtc INTERFACE "${CMAKE_CURRENT_LIST_DIR}/libwebrtc_linux_fixups.cpp") target_link_libraries(libwebrtc INTERFACE dl rt m) + + if(_build_libcxx) + # Chromium's libc++ and libc++abi, with the flags of its buildtools/third_party/libc++*/BUILD.gn + set(_llvm "${LIBWEBRTC_ROOT}/llvm") + file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/libcxx/runtime.sha256" _runtime) + list(TRANSFORM _runtime REPLACE "^[0-9a-f]+ " "${_llvm}/") + list(FILTER _runtime INCLUDE REGEX "/libcxx(abi)?/src/.*\\.cpp$") + set(_libcxxabi_sources ${_runtime}) + list(FILTER _libcxxabi_sources INCLUDE REGEX "/libcxxabi/") + add_library(chromium_libcxx STATIC ${_runtime}) + set_target_properties(chromium_libcxx PROPERTIES + CXX_STANDARD 26 + CXX_VISIBILITY_PRESET hidden + POSITION_INDEPENDENT_CODE ON + UNITY_BUILD OFF + ) + target_compile_definitions(chromium_libcxx PRIVATE + ${_libcxx_defines} NDEBUG _LIBCPP_BUILDING_LIBRARY LIBC_NAMESPACE=__llvm_libc_cr + ) + target_compile_options(chromium_libcxx PRIVATE ${_libcxx_options} -fstrict-aliasing -w) + target_include_directories(chromium_libcxx PRIVATE "${_llvm}/libcxx/src" "${_llvm}/libc") + set_source_files_properties(${_runtime} PROPERTIES COMPILE_DEFINITIONS LIBCXX_BUILDING_LIBCXXABI) + set_source_files_properties(${_libcxxabi_sources} PROPERTIES COMPILE_DEFINITIONS + "LIBCXXABI_SILENT_TERMINATE;_LIBCXXABI_USE_FUTEX;_LIBCPP_CONSTINIT=constinit" + ) + + # libwebrtc calls SME ABI routines (__arm_tpidr2_save) that only compiler-rt provides, not libgcc + execute_process( + COMMAND "${CMAKE_CXX_COMPILER}" --rtlib=compiler-rt -print-libgcc-file-name + OUTPUT_VARIABLE _builtins + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT EXISTS "${_builtins}") + message(FATAL_ERROR "Clang's compiler-rt builtins not found (${_builtins}), install compiler-rt") + endif() + target_link_libraries(libwebrtc INTERFACE chromium_libcxx "${_builtins}") + endif() endif() diff --git a/pyproject.toml b/pyproject.toml index f53d02e..4509a90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,10 +87,11 @@ test-groups = ["test"] test-command = "pytest {project}/tests && pytest {project}/tests --gc-on-emit" [tool.cibuildwheel.linux] -archs = ["x86_64"] +archs = ["native"] manylinux-x86_64-image = "manylinux_2_28" -# libwebrtc for Linux is compiled against Chromium's libc++, which needs Clang -before-all = "dnf install -y clang lld" +manylinux-aarch64-image = "manylinux_2_28" +# libwebrtc for Linux is compiled against Chromium's libc++, which needs Clang; arm64 links compiler-rt +before-all = "dnf install -y clang lld compiler-rt" environment = { CC = "clang", CXX = "clang++", WRTC_CACHE_DIR = "/tmp/wrtc-cache" } [tool.cibuildwheel.macos]