fix chromium sync

This commit is contained in:
Jared Allard 2025-01-08 21:03:42 -08:00
parent e285762cbb
commit c6a642bf11
Signed by: jaredallard
SSH key fingerprint: SHA256:wyRyyv28jBYw8Yp/oABNPUYvbGd6hyZj23XVXEm5G/U
15 changed files with 5729 additions and 1799 deletions

View file

@ -1,15 +0,0 @@
diff --git a/@@EBUILD@@ b/@@EBUILD@@
index 63466f33a755..1e1575885791 100644
--- a/@@EBUILD@@
+++ b/@@EBUILD@@
@@ -401,6 +401,10 @@ src_prepare() {
"${FILESDIR}/chromium-117-system-zstd.patch"
)
+ if use widevine; then
+ PATCHES+=("${FILESDIR}/chromium-001-widevine-support-for-arm.patch")
+ fi
+
if use system-toolchain; then
# The patchset is really only required if we're not using the system-toolchain
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )

View file

@ -24,13 +24,9 @@ cp -r "${tempDir}"/www-client/chromium/* "${DIR}"/
# Patch all the ebuilds.
for ebuild in *.ebuild; do
for patch in .patches/ebuilds/*.patch; do
# Copy the patch to a temporary file and rescope it to use this
# file.
cp "${patch}" "${patch}.tmp"
sed -i.bak "s|@@EBUILD@@|${ebuild}|g" "${patch}.tmp"
patch -p1 <"${patch}.tmp"
done
# Add our patch.
patches_end_ln=$(cat -n "$ebuild" | sed -e '/local PATCHES=(/,/)/!d' | tail -n1 | awk '{ print $1 }')
sed -i.bak "$((patches_end_ln+1))i\ \n if use widevine; then\n PATCHES+=("\${FILESDIR}/chromium-001-widevine-support-for-arm.patch")\n fi\n" "$ebuild"
# Mutate KEYWORDS to only be scoped to arm64. Determine if stable or
# not based on the amd64 keyword.

View file

@ -1,24 +1,23 @@
DIST chromium-128-clang.tar.xz 51489372 BLAKE2B 352a585e3acf0f0685ab2eaeb13e847195119bc6e3694f7fc20eeabdb25821019187e52997618214ccb469766c2982f489c6bdc643a339c1cfbe3e5fb3a131d4 SHA512 bc448096975111ff6ff5a9f82a6acb2bb244e9c344a8e6ef8bcdee5a06d0004955f76f6566f01519da5cc2eae08a2df2dd0ac5afee38dbc2ba918e735f338422
DIST chromium-128-rust.tar.xz 148907072 BLAKE2B 9b28d1eca65d3e62ef142f96d9b3371bb65c6778414e5b64f0ad02c4aace219974f1cb292c9a6d9c443e3ed4f61192248ccaf9b18079cbd5a5f5c3abfe79d485 SHA512 5469490b23656a83d6198a087ddb82dd342fd8a426b32193218f7174395053f2ec7aaced5c464b8b16cdbddc252f80a98ca2a4b88742d2b0c910f2d2bfa7e431
DIST chromium-128.0.6613.137.tar.xz 6724182764 BLAKE2B 9f4d77b058af1619a4a13beac31ea463bd3d02086c172fb074d510b3f1dcba284fb1fa9ac5883ade2c2855f851a22bcbd4503960b4a27bc5844f16ad81558aba SHA512 3be85d2270a70ce3779b57e5d011e45312c67607e9e7c7f7ef396c515e37fed767105dfe0cc1f76830b007cebc05662f5318750c656c8a9765a25fa62036df6e
DIST chromium-129-clang.tar.xz 52250752 BLAKE2B c7223a1f4a9f52eb631b968ecaea528d19aa14ded23e03e530ad6c46e7e1579a7a010cb347489f1b963013b4f26358be94aeff0f98b5eceb7b1f1e49e8acdfd3 SHA512 43681d64d4480e3f69afd3021037af6910e9c64052edefdb72e99b0a85cd94c4a8eb4095188784d7fa7f52fae10a9bd9db53f2bb80e89f709f92af7ce6403976
DIST chromium-129-rust.tar.xz 152042272 BLAKE2B acde4dc9c0fe232d16f07f3e4b719ea762627e234970866e0de56ec3959c4cd0a7b1b09cf5ccecd50efd1cc35dcf224be3b398c1ea19a79731d6db13c94fa7a9 SHA512 bef8e56cf73de5cefd5fe0bb9836ef65012406ff3d364d36624d30e7b5cdb2634d17ac9e49a60ccb0ac5dd57cf4311b587c5ff0cec26b2fc6e15274abe0dc85b
DIST chromium-129.0.6668.100.tar.xz 6677334468 BLAKE2B b68896322673762ce49ac18dcd731011516f3eff3e98561bcfc2404fea7e5bf8c39fa8c5b19e0dc26f188ec8787ba2b729580024a0ca205c891eaf48a4a0e134 SHA512 366be6dbde59e979186174525431d4823449e0c031bb4dc290f747c7525de44f3e2c821a0c4cd1bbb47ae3bee9fa24efdaa465d8d883791f6c63f20760a4fb48
DIST chromium-130-clang.tar.xz 52892060 BLAKE2B 7d2619ab3762569fb77bce8ff19056caa07b430e3ed830fdc4a6445611771ee30fd5e7c8bf90c994d5cacc57f516974b0c1c6d973cba52aae0d7fc6de0bde26c SHA512 3c1c4c771e6aa3a15395c16e899729b751cb9cecb27b77a11ccaf079b6a913ac2d5176a3c628d2270653f3d6c66f3d136304d9957dbf18b6632b787c6102e784
DIST chromium-130-rust.tar.xz 115068636 BLAKE2B 7d2ed89372fce24de7432e62100767e3559c53733446bab003c80cc97d5a38168df0ff662f7e896548fecc9bc919b85b63001eb40e4fa1fbb63fb34545513d67 SHA512 9a310a65f61ea455cbcabf58fc4104b8c2a89f1c40f6b45b2105b701255d7f786ec950d76c99f3b8b77d3dd07262cc22cd30a78497a460aad689971129b9970d
DIST chromium-130-testfonts.tar.gz 32750602 BLAKE2B 498f8b2e0811c98dc3d4aaa75559e69c782afb4bd12328cfdb7244ddba5cae7ee47becd27b2549d7b36bed417601f70f4c192934b0f08496cef1547d0502d93c SHA512 96b090446862997c8134e2971f0e38793ecc1208d547e554c9b651ccfb4127c4de86754903fea57a7292a2823c45117bae0ec13ed87aed20c248fb779579fbde
DIST chromium-130.0.6723.58-testdata.tar.xz 281068572 BLAKE2B e9f98f07c11015a361de8ad232aaed339aeb1208dcf25a5e91ace18c32b5184ed911bb53df19869ad645b29a3025f3f523197db0044c83f0004620efdcf25965 SHA512 560e2f848c71460897292c6f9442e34b985794de918b66d2c0fb4adee1c70c99e9251cfcaa6944e4a4d1f4b1c46430622a19a6586e01f94c7d611b7e8d193f17
DIST chromium-130.0.6723.58.tar.xz 6613711856 BLAKE2B 80ceb5418517aa19e8b0d1b0429aa0ac118e8e88a33e5385c5a2fcd7eb1119ef46e95cf2d1baa235ab023c222e92ae33c14825ec76988ecfab66d7663fe59790 SHA512 f9b609250bcf8e419dc34aafac942c447f22e264ee72d2f0970b2f08d5b9fa03c4ca362c9cfa0d7d277abdda2f0aeadeffcd250c92b7588cf48fc5ec1d26680b
DIST chromium-130.0.6723.69-testdata.tar.xz 281900320 BLAKE2B 17cc8481f4d15570706ab7358bf359543ac425b2fb35c209a854d9958b1fd02e0e4d48f23d27611e93742318470db8ce5bd30b71f5fb89884e7034c9858ff3a4 SHA512 b63afd7a4063ea0b9b09da9b99eb08fd11577310c55bd23a1018ea9932fc8a0699efca89141c5f0c5adc9fee8ede8efd00c9fa1e78ab754d769939de60c95ac5
DIST chromium-130.0.6723.69.tar.xz 6620926572 BLAKE2B 344971f25480e630ccc69162273369ef62108e6336555a0a9bafcd82aa659f869ea322388c30abc482fc2dbdcb46578050d2a6451c5c9e8a5413cf5d9e0cd5bd SHA512 7df415e01dc1d212faf0522b29f9daa6f54d68f2d1cdcf13bc06ceb6cf55fcef374ac5ce39d049968970c7cc37f9ea303a4716d86751aed6efe9d6d315e747ec
DIST chromium-131-clang.tar.xz 52892060 BLAKE2B 7d2619ab3762569fb77bce8ff19056caa07b430e3ed830fdc4a6445611771ee30fd5e7c8bf90c994d5cacc57f516974b0c1c6d973cba52aae0d7fc6de0bde26c SHA512 3c1c4c771e6aa3a15395c16e899729b751cb9cecb27b77a11ccaf079b6a913ac2d5176a3c628d2270653f3d6c66f3d136304d9957dbf18b6632b787c6102e784
DIST chromium-131-rust.tar.xz 115068636 BLAKE2B 7d2ed89372fce24de7432e62100767e3559c53733446bab003c80cc97d5a38168df0ff662f7e896548fecc9bc919b85b63001eb40e4fa1fbb63fb34545513d67 SHA512 9a310a65f61ea455cbcabf58fc4104b8c2a89f1c40f6b45b2105b701255d7f786ec950d76c99f3b8b77d3dd07262cc22cd30a78497a460aad689971129b9970d
DIST chromium-131.0.6753.0.tar.xz 6639635464 BLAKE2B a87035be45d530e8b84eb19fc90d0f6aab95920a95b8e5bac88fa6558a2e1b8cc15691ba868b5345168ea0480f2b4f1a08ae1dd9c8b88ab3035d721897f21e2e SHA512 20fcdaa63e57b59575c858e51fad87ef21a0d76fcb7261e46c506329e4847e9fdb935e9b9d93d3d1d67f784a894f2bc817465a730a8483dfba02f142787018f3
DIST chromium-patches-128.tar.bz2 5087 BLAKE2B b0321fb45390a282afeeeb8fb4d6014d6e6b708e6851235e0897ac77d524160b4d33476aa70532df45d0ccf233fee3b4028cd4d845667dc6a2a46ecebfeb6752 SHA512 978908d27dc6fc620209486a9ad7f73babde8710728960f44f2680445276516e59a85c08656af2663d9e197df45874f24a1f19f14a21798fbcf7c5a10bb19371
DIST chromium-patches-129.tar.bz2 5071 BLAKE2B 080e1af8b0560a3c5365674e7c8d592310bbd2e273311b775b8112e410d91ccd48f170adbcf77cff566ad32de196217410663ac7b9e7e65544b6730fb1890aca SHA512 0a5bbc07dc9085b07332d5c6dd74940a9d55c4d0677f5603e75763ba54156f43664839d438f350bc86f3efc85aae452476e7f7040e06e60727847b156d1f0ab9
DIST chromium-patches-130-1.tar.bz2 5035 BLAKE2B c8784123681bcedc7f4c508845f884da8e501d2917cd3174e5cc6c3505dc032f5d52132d997c7d3f57f0c3720f34b21a8eb9af915a3be017528db6dabd9d87da SHA512 6bbe06b915a3235fd4660c3193f4140a9be8c4a6d7a0fc6ec187886d9b46ea2e77634285e79fb0842e7a7acc77f438d86e94d45f203390b2607ed6fb2350b57e
DIST chromium-130.0.6723.116-gentoo.tar.xz 4699442864 BLAKE2B 571a012f449b757b6a17309cedb3c5cc7da73dc24b1e352554ab14ded9761ce29c62531e9fcb6c0a2290f89bff0e81f4d2cf39f0984bc5c7fc5e9be8c37bcb59 SHA512 e54beef2b445375cba0b1a290a99f7b41b2b9b965c89c0bb062c99be0825ccf64259440bd2b032bb5b1e46eef15b4a4f66fdaeb9974fcfe6f70d55a49ca47850
DIST chromium-130.0.6723.116-testdata-gentoo.tar.xz 83048 BLAKE2B d95970073cedb9dd5488886c94c0b629a0a15f248e66a409b57be89b52eececf845c3d79f6bde51f4476e927a058ee257bb6d1b3ca0332910660a6e045ccb00d SHA512 0df42b1e8a3c0be8a07d71153a8bc5fdfc59a18d574d8dfd2fd1a3e17ca197e71dfd332c02547e6b456b5037c924dbbecc4551ac1695f36181e3a9cc884ff83b
DIST chromium-131.0.6778.139-linux-testdata.tar.xz 279152856 BLAKE2B 41f96d726ed0be06735d78f8430031b083e46652a3f94e7ef664502564f850975e3a8755963ee61458d47d779a9676452216322026cd891ae0eb85f664e9bd87 SHA512 99b4b08948ad5dcb9ed931b7b7019bcd015dbdc2bd420be1383d662a179c61e260ff94b7038f2f7a086a91bf2f733d973c2f1b45581f883da877946123b7e096
DIST chromium-131.0.6778.139-linux.tar.xz 2189495224 BLAKE2B 5e32ffa9de17df58b4017c90dd19b9cf1699c94f2ea1f38890821ef4bc3ed5c558c31cb0d57fb5b00c9bede6a953efc553fd8efa14354fd2314ca6e79bdac27e SHA512 b5aa8045edf483c9c53fe9fc253cd6f62ebef51f2b9dc9d59c225705d68ae7fdd88870fac5162ca7d9d9c4e0e778cdf27e4f9bd93bed8c059e0d1eab5ccac767
DIST chromium-131.0.6778.204-linux-testdata.tar.xz 279220900 BLAKE2B ab46bc825ba4d70696bf4441b22d36d45fb4c492ff234ccd0e26d66f9cc3790634f72dfcd81db299f0e0f77bc209ab24057a29e9937a8aefdca5109cce064eae SHA512 a7d97e216c1cc1f4145912b94b85a1c80ee57504b6792f0399ca5bff6494fc24c9cc846179de313f876d04e864ff79465df84997649c7d26d55b9d2848cb31f3
DIST chromium-131.0.6778.204-linux.tar.xz 2189629432 BLAKE2B 35a254700ff906e5f94b07ee4d577e1e4d356ee35972d03dc7c5cfd282e8e2400bd35548ad0bd1619654634abcaffed83d8bc1267727afee0a4294d1fbb3db77 SHA512 86f9fadfc8f2b46c16783767fd10e84129a65d3d7aa22e40d8adb8125e6b1e30f4fbf32d46d482f12999ab6e3fc5a47938921a7ccc77a43a1112003d8805c823
DIST chromium-131.0.6778.264-linux-testdata.tar.xz 279207424 BLAKE2B c3da4c4e00717ea53ae2fa774bf313b805966ba96ad6c5dbe72cd0b6e50f414023e475026b87b58e8b06dfc6bf9890852ca8a76f3c12004aa5e7f9b84e5cc665 SHA512 fb28a206102a5e85c28e8bd2a2c1077b8dc67edba7633783edf5e3a57b01e402fcd0638f8f0b268c839c3ed74d87d82a3ef52b41e3c1755973c27f9b824c817a
DIST chromium-131.0.6778.264-linux.tar.xz 2189651292 BLAKE2B aa9277ce7211b253f5f38641eeb7531be9edb7fc97f668a23a931f98d6671d3ebeda1b2e900a117acac9edb432f7a0ceb75e7b545752b642e27288ac44043827 SHA512 63bc7c79589ceffed2d089fec9fffcaa1f0b50aa1929da4b173de838ad13bf9c8c989001978d8f5d8a667a946124f897595a2ee206c5f04d05e5b05460b115a1
DIST chromium-132.0.6834.46-linux-testdata.tar.xz 299805496 BLAKE2B e3a5ca8fe2d557ac4f2b731b30c9fbb781e362d5f62d09e93bb4c899f07a841be5467cacfc6c690fac599d9bbc4057e99a03702925fb62fffc206a57781cbb18 SHA512 0ff0cb4d5ce75b63583d003c6a6d9fca895cdeec7e67c65a75ff4468628fc5ffbacdbf9df250bb8a66419205c5ad1933f0f228e821d019d35973ce6ad3ca2b92
DIST chromium-132.0.6834.46-linux.tar.xz 2193310724 BLAKE2B edacfec054f9ebc51fed26aa20222f6a9c61f0c503484cbef4081d819d110465f661ae1fc18bb4cd0223ed7917a4d191af6cc8f32c8d0ff65e750408b62f5dd8 SHA512 2c161b71ce988d864ea5353221fc1b8eefbf8b26dc4e31c8312574b749e44d07a80f52fea18bf5c9e9f08c90fe724fb20c97963472883fb8a3b49482874878b8
DIST chromium-132.0.6834.57-linux-testdata.tar.xz 299792072 BLAKE2B bd48dc8a5cbe8286e01a9155c76ed0e4f2ec127bee21500410c5a7cfbdf403abb22ffd76ca03ba3b5ba2d4cc7721d776669cce136ce0576be68aaa8b7b665ef8 SHA512 2276fc6fcca05c17ccbe4af9972615924372a79f70145c274d63b126daf4e14900a5d6c178673512710374e7ed188cb3c46782825e969381719373144539a129
DIST chromium-132.0.6834.57-linux.tar.xz 2193464100 BLAKE2B 9720b6ec8fa8566e19155527d6f55c9dbd48c7e1384232cb4f928a47b1d8d9d57eb68220929ac338afc5546bbe67d6f35aac45bc5c0ec5cad152bb7017c1d616 SHA512 be9ec2958f61003373a51d9796b8310877734dbe88b1f79213c5e72eea5b8d34d4fc8d0b9303e90beb275dcb19e50efe59c5b364a9719efea3917fe9e4992fc6
DIST chromium-133.0.6888.2-linux-testdata.tar.xz 299227756 BLAKE2B ecf1a79034c9c06fcd667d812ae7ee4b05b60e9dc1a0db587c7d0c3af5ad8b787b1b885abcc27ec4a3cf89ec3038f686f1d37410109c4845e32c4dec9ead7af4 SHA512 fb37b91b243bc584da41f1be58932817dd757a2be0acfa01aafa23c15a53250934938ea8e51efb3f40d3fbcc12af20b7d13cc1364720a2d4cb977ea6ce432493
DIST chromium-133.0.6888.2-linux.tar.xz 2286980464 BLAKE2B 747741f415ad00be3120cebd4a691a39f3f0374e57f57272700c366ba50d394359fb22fdc6a89f7ab41a49ff59f2c6c7e664aee1a003be75a4651dd1e642b39e SHA512 11e18014e9f4d3e7ff6b7c8789546a0d8f0d4a24b6fa413c1e10e6d911f4d81fa1c8b1803a9d5e7bf1f8243710c2ad0aa625b2ba6ca52ad9964e37d2b7851af7
DIST chromium-133.0.6905.0-linux-testdata.tar.xz 299295120 BLAKE2B 7242308e0bef753e090b0f70e4d4017ebac12bfe9dd2254263ae79db2a8d9294c96d3f74297b6f5f3bfacf766dcb0e73314ef76b2d370ecf7b142f12ac9c7935 SHA512 8793bb0d27073851dc5a00183d88001b65de54390c8a3ed4c7fa72e9c0aa4b9d285bc8eabeddf1b8b3d10876c2d30134945f10509fdcf7e27f3c1e23e38faffc
DIST chromium-133.0.6905.0-linux.tar.xz 2291017800 BLAKE2B bf78df51b3dbf3e0eb97afce911b6e95403d516e978a731f65286aa07841c2f9bf075893e0378cbaf5e5b50f97990f6e09df4262a2e027c2c1d42df638504478 SHA512 b212ebf4534ed38e4d643787f012762786ede5d39c027cdbded703a9dd53712c440ab621eb51c18f69c2b1a5d7e845fa469c84672a6014f8df32b51b5f04b306
DIST chromium-openpower-a85b64f07b.tar.bz2 387899 BLAKE2B b01fda2d64ce73068d1536a10cc0896f07a4b714cdb25698b1df8b3252baa0c21c4209b307cf1cb554854f6d0bfe3cd35e06aaa8d02ac5d409a119335084c324 SHA512 05eee81677e8766808441c939bee68e2e6c58ec91f471d88a40181d2eda78614a0a6d27d92ff8f9dda564d12f3451bace4ff2727594748c5c238a3533038019b
DIST chromium-patches-130-2.tar.bz2 10151 BLAKE2B b46515a3e01153d8c4e5c3ee1f6e9f905265bf88b698d46c8ceed0f90d36a057b8bb30a860e8d934bf0b85f9c0a671bef2c9a00349228fa076b7aec37ff62ca0 SHA512 e1ecca666c3998ee285426751be3220a5b67a057f2c92b1f45c7b786efb8d0b0e1d49ba70471fa74155f79f22811d240af636f61007191756c9981b53d3b23de
DIST chromium-patches-131-1.tar.bz2 4932 BLAKE2B 72006a6d751ae1207352547cdeef87f8cc9f9639283238da201d879c6fcd0f8bc499669cb030d8b4c2216fcd2730de46b0a071007b3d69a2bbdd22ba38bcd279 SHA512 11d7f861c007e9e28e5192fb354940180aea0e01e6e8ae77547e2dffd7b541b11f1acfe0fd0c8b6b4cbfc6c39ddfa79c8c08db42c1292ad329d49027d1406fc3
DIST chromium-ppc64le-gentoo-patches-1.tar.xz 5636 BLAKE2B 1d898939df023c59285b27bee552470483ea06375d1ee8d6947b89c5927c23cc7bfec6b49f3b376ece931d11a56f8e2a45791e0f92ad61974fc8c34c1082d89c SHA512 8a71cb007e47cda8e5fe5d185729389e65c48bd322c8ee8b3986bee8571427b959628f2666bda646a3f89ae64197c0957d3626845ff03461dbd5dee4c964d07c
DIST chromium-patches-132.tar.bz2 5040 BLAKE2B d5bd84dd90b395c6a15135637f51f931c72a2f301b1c24e9b938c744f2767fa36857b8edfdf5c44cf085a1efcb40475401fec226ce43446442f32fb174b55355 SHA512 29833b306a34ab6562ee58eb03669818da7235cd36666b27d829bcbd3c4d0035a530fb6be1c33cf88c1c11d43e68e3781f9b9602c0c004e7a37ffa69f9ee17c7
DIST chromium-patches-133-1.tar.bz2 10661 BLAKE2B c8a141bd10e628533e373b08969f95443eb6ae7f4497359db02f370147ac6132fbc31db28915ebdd9f150c13be78f06af938bd7dffdf2c23d90e1b9e07bd92ab SHA512 48a356872acc41c96c92366bd09de5a1c4af87fe4c480dccc7bd7a2aae5c3be8e6411151ed36303a127022001248bd25ef8305e83bd0d533660e3f11943af686
DIST chromium-profiler-0.2.tar 259952640 BLAKE2B 5e82389fce00b267280d633b26551231c558b80f0c92cd7d60271095a3503365ab673e7a46dc5f74f8a82db1f21262cb24dcc0531d954bab5fb3b175dab3394d SHA512 9fa89a5ab728419683e7495ae676567480987d68a2d589f2aa97bfcbcf123f3c8f97f8bca5f65e5e3f6e41475535add473ded83b9c7a33bb4746a9d05b298a6c
DIST chromium_128.0.6613.119-1raptor0~deb12u1.debian.tar.xz 8673272 BLAKE2B 0ae1ead2b8d0ce196d5d16e132194da12d3dde3b43c270f794630c3427d38aaac6c6a289ac64b4748354e9d4d20ae8597076b64a4b7a7e1225c66a9f86e9f7ff SHA512 c896f8f07aa44cd6950375b36fe89fc2780ff9867e01feab71100c8551b22d3c89c5ba9e80cffbad22ff8575d20fc782b70969a51c68384fd8de62a09c4ffdcf
DIST chromium_128.0.6613.84-1raptor0~deb12u1.debian.tar.xz 8674292 BLAKE2B 74c8556f578231cd133ce3a11306ce38d32332a3db7b0f32a63df1806201933e69e9ff01e66d7ccef279f2134e0a69c89365d7a08a7a7e7d69816a188ae0b91c SHA512 b1b85bc99493676d466e648c00eb7e337efbcb197e9ed5ae6394133721db828583340df5ebfa45a3dccc72f400ad6ada637d400d8e2fae35c1322ca5e15dc10e
DIST chromium-testfonts-f26f29c9d3.tar.gz 32750602 BLAKE2B 498f8b2e0811c98dc3d4aaa75559e69c782afb4bd12328cfdb7244ddba5cae7ee47becd27b2549d7b36bed417601f70f4c192934b0f08496cef1547d0502d93c SHA512 96b090446862997c8134e2971f0e38793ecc1208d547e554c9b651ccfb4127c4de86754903fea57a7292a2823c45117bae0ec13ed87aed20c248fb779579fbde

View file

@ -5,32 +5,11 @@ EAPI=8
# PACKAGING NOTES
# Google roll their bundled Clang every two weeks, and the bundled Rust
# is rolled regularly and depends on that. While we do our best to build
# with system Clang, we will eventually hit the point where we need to use
# the bundled Clang due to the use of prerelease features. We've been lucky
# enough so far that this hasn't been an issue.
# We use llvm-utils.eclass directly due to chromium's inherent Googliness.
# GN is bundled with Chromium, but we always use the system version. Remember to
# check for upstream changes to GN and update ebuild (and version below) as required.
# For binhost users, if USE=bindist is set, we configure Chromium in a way that it is able
# to use proprietary codecs, and so that ffmpeg is an external component (libffmpeg.so),
# then we remove ffmpeg from the image to ensure that the built package is distributable
# (i.e. we don't owe royalties). A suitable libffmpeg.so is symlinked in its place;
# as a result of this, ffmpeg[chromium] or ffmpeg-chromium must be installed on the system.
# For non-binhost builds, we build the bundled ffmpeg and enable proprietary codecs because there's
# no reason not to. Todo: Re-enable USE=system-ffmpeg.
# This uses a gentoo-created tarball due to Google CI Failures.
# Use 132 as a base for new official tarballs.
GN_MIN_VER=0.2165
RUST_MIN_VER=1.78.0
# chromium-tools/get-chromium-toolchain-strings.sh
GOOGLE_CLANG_VER=llvmorg-20-init-1009-g7088a5ed-10
GOOGLE_RUST_VER=595316b4006932405a63862d8fe65f71a6356293-5
: ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN=no}
# chromium-tools/get-chromium-toolchain-strings.py
VIRTUALX_REQUIRED="pgo"
@ -38,43 +17,46 @@ CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
sv sw ta te th tr uk ur vi zh-CN zh-TW"
# While prerelease llvm is actually used in the google build, until we have a
# sane way to select 'rust built with this llvm slot' that isn't stable and testing
# subslots we will have to restrict LLVM_COMPAT to stable and testing keywords.
LLVM_COMPAT=( {17..18} )
LLVM_COMPAT=( 18 19 )
RUST_NEEDS_LLVM="yes please"
PYTHON_COMPAT=( python3_{11..13} )
PYTHON_REQ_USE="xml(+)"
RUST_MIN_VER=1.78.0
inherit check-reqs chromium-2 desktop flag-o-matic llvm-utils ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 systemd toolchain-funcs virtualx xdg-utils
inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 rust systemd toolchain-funcs virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="https://www.chromium.org/"
PATCHSET_PPC64="128.0.6613.84-1raptor0~deb12u1"
PATCH_V="${PV%%\.*}"
SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
system-toolchain? (
PPC64_HASH="a85b64f07b489b8c6fdb13ecf79c16c56c560fc6"
TEST_FONT=f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35
PATCH_V="${PV%%\.*}-2"
SRC_URI="https://chromium-tarballs.distfiles.gentoo.org/${P}.tar.xz -> ${P}-gentoo.tar.xz
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2
)
!system-toolchain? (
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-${GOOGLE_CLANG_VER}.tar.xz
-> chromium-${PV%%\.*}-clang.tar.xz
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/rust-toolchain-${GOOGLE_RUST_VER}-${GOOGLE_CLANG_VER%???}.tar.xz
-> chromium-${PV%%\.*}-rust.tar.xz
test? (
https://chromium-tarballs.distfiles.gentoo.org/${P}-testdata.tar.xz -> ${P}-testdata-gentoo.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz
)
ppc64? (
https://quickbuild.io/~raptor-engineering-public/+archive/ubuntu/chromium/+files/chromium_${PATCHSET_PPC64}.debian.tar.xz
https://deps.gentoo.zip/chromium-ppc64le-gentoo-patches-1.tar.xz
https://gitlab.solidsilicon.io/public-development/open-source/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
)
pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
LICENSE="BSD"
SLOT="0/stable"
KEYWORDS="arm64"
# Dev exists mostly to give devs some breathing room for beta/stable releases;
# it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="~arm64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo +proprietary-codecs pulseaudio"
IUSE+=" qt5 qt6 +screencast selinux +system-toolchain +vaapi +wayland +widevine"
RESTRICT="!bindist? ( bindist )"
IUSE+=" qt5 qt6 +screencast selinux test +vaapi +wayland +widevine cpu_flags_ppc_vsx3"
RESTRICT="
!bindist? ( bindist )
!test? ( test )
"
REQUIRED_USE="
!headless? ( || ( X wayland ) )
@ -182,29 +164,6 @@ DEPEND="${COMMON_DEPEND}
)
"
depend_clang_llvm_version() {
echo "sys-devel/clang:$1"
echo "sys-devel/llvm:$1"
echo "=sys-devel/lld-$1*"
echo "virtual/rust:0/llvm-${1}[profiler(-)]"
echo "pgo? ( sys-libs/compiler-rt-sanitizers:${1}[profile] )"
}
# Parse LLVM_COMPAT and generate a usedep for each version
depend_clang_llvm_versions() {
if [[ ${#LLVM_COMPAT[@]} -eq 0 ]]; then
depend_clang_llvm_version ${#LLVM_COMPAT[0]}
else
echo "|| ("
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
echo "("
depend_clang_llvm_version ${LLVM_COMPAT[i]}
echo ")"
done
echo ")"
fi
}
BDEPEND="
${COMMON_SNAPSHOT_DEPEND}
${PYTHON_DEPS}
@ -216,14 +175,16 @@ BDEPEND="
qt5? ( dev-qt/qtcore:5 )
qt6? ( dev-qt/qtbase:6 )
)
system-toolchain? (
$(depend_clang_llvm_versions)
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
$(llvm_gen_dep "
llvm-core/clang:\${LLVM_SLOT}
llvm-core/llvm:\${LLVM_SLOT}
llvm-core/lld:\${LLVM_SLOT}
")
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
>=dev-build/gn-${GN_MIN_VER}
dev-build/ninja
dev-lang/perl
@ -313,125 +274,59 @@ pkg_pretend() {
fi
}
# Chromium should build with any version of clang that we support
# but we may need to pick the "best" one for a build (highest installed,
# rust is built against it, etc.)
# Check each slot in LLVM_COMPAT to see if clang/llvm/lld are available
# and output the _highest_ slot that is actually available on a system.
chromium_pick_llvm_slot() {
# LLVM_COMPAT is always going to be oldest to newest (or one value)
# let's flip it and check from newest to oldest and return the first one we find.
local slot
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
slot=${LLVM_COMPAT[i]}
if has_version "sys-devel/clang:${slot}" && \
has_version "sys-devel/llvm:${slot}" && \
has_version "sys-devel/lld:${slot}" && \
has_version "virtual/rust:0/llvm-${slot}" && \
( ! use pgo || has_version "sys-libs/compiler-rt-sanitizers:${slot}" ) ; then
echo "${slot}"
return
fi
done
die_msg="
No suitable clang/llvm/lld slot found.
Slots checked: ${LLVM_COMPAT[*]}.
"
die "${die_msg}"
}
# We need the rust version in src_configure and pkg_setup
chromium_extract_rust_version() {
[[ ${MERGE_TYPE} == binary ]] && return
local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
rustc_version=${rustc_version[0]#rust-bin-}
rustc_version=${rustc_version#rust-}
[[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
echo $rustc_version
}
pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]]; then
# The pre_build_checks are all about compilation resources, no need to run it for a binpkg
pre_build_checks
if use system-toolchain; then
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
if ! tc-is-lto && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
LLVM_SLOT=$(chromium_pick_llvm_slot)
export LLVM_SLOT # used in src_configure for rust-y business
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
fi
# The llvm-r1_pkg_setup we have at home.
# We prepend the path _first_ to explicitly use the selected slot.
llvm_prepend_path "${LLVM_SLOT}"
llvm_fix_clang_version CC CPP CXX
llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB
llvm_fix_tool_path READELF STRINGS STRIP
# Set LLVM_CONFIG to help Meson (bug #907965) but only do it
# for empty ESYSROOT (as a proxy for "are we cross-compiling?").
if [[ -z ${ESYSROOT} ]] ; then
llvm_fix_tool_path LLVM_CONFIG
fi
einfo "Using LLVM/Clang slot ${LLVM_SLOT} to build"
local rustc_ver=$(chromium_extract_rust_version)
if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
eerror "Rust >=${RUST_MIN_VER} is required to build Chromium"
eerror "The currently selected version is ${rustc_ver}"
eerror "Please run \`eselect rust\` and select an appropriate Rust."
die "Selected Rust version is too old"
else
einfo "Using Rust ${rustc_ver} to build"
fi
# Chromium requires the Rust profiler library while setting up its build environment.
# Since a standard Rust comes with the profiler, instead of patching it out (build/rust/std/BUILD.gn#L103)
# we'll just do a sanity check on the selected slot.
# The -bin always contains profiler support, so we only need to check for the non-bin version.
if [[ "$(eselect --brief rust show 2>/dev/null)" != *"bin"* ]]; then
local rust_lib_path="${EPREFIX}$(rustc --print target-libdir)"
local profiler_lib=$(find "${rust_lib_path}" -name "libprofiler_builtins-*.rlib" -print -quit)
if [[ -z "${profiler_lib}" ]]; then
eerror "Rust ${rustc_ver} is missing the profiler library."
eerror "ebuild dependency resolution should have ensured that a Rust with the profiler was installed."
die "Please \`eselect\` a Rust slot that has the profiler."
fi
fi
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# This is effectively the 'force-clang' path if GCC support is re-added.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Users should never hit this, it's purely a development convenience
if ver_test $(gn --version || die) -lt ${GN_MIN_VER}; then
die "dev-build/gn >= ${GN_MIN_VER} is required to build this Chromium"
@ -442,26 +337,23 @@ pkg_setup() {
}
src_unpack() {
# In 126 Chromium upstream decided to change the way that the rust toolchain is packaged
# so now we get a fancy src_unpack function to ensure that we don't accidentally unpack
# one toolchain over the other. The addtional control over over unpacking also helps us
# ensure that GN doesn't try and use some bundled tool (like bindgen) instead of the system
# package by just not unpacking it unless we're using the bundled toolchain.
unpack ${P}.tar.xz
if use system-toolchain; then
unpack chromium-patches-${PATCH_V}.tar.bz2
else
unpack chromium-${PV%%\.*}-clang.tar.xz
local rust_dir="${WORKDIR}/rust-toolchain"
mkdir -p ${rust_dir} || die "Failed to create rust toolchain directory"
tar xf "${DISTDIR}/chromium-${PV%%\.*}-rust.tar.xz" -C ${rust_dir} || die "Failed to unpack rust toolchain"
fi
unpack ${P}-gentoo.tar.xz
unpack chromium-patches-${PATCH_V}.tar.bz2
use pgo && unpack chromium-profiler-0.2.tar
if use test; then
# A new testdata tarball is available for each release; but testfonts tend to remain stable
# for the duration of a release.
# This unpacks directly into/over ${WORKDIR}/${P} so we can just use `unpack`.
unpack ${P}-testdata-gentoo.tar.xz
# This just contains a bunch of font files that need to be unpacked (or moved) to the correct location.
local testfonts_dir="${WORKDIR}/${P}/third_party/test_fonts"
tar xf "${DISTDIR}/${P%%\.*}-testfonts.tar.gz" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
fi
if use ppc64; then
unpack chromium_${PATCHSET_PPC64}.debian.tar.xz
unpack chromium-ppc64le-gentoo-patches-1.tar.xz
unpack chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
fi
}
@ -483,40 +375,46 @@ src_prepare() {
)
if use widevine; then
PATCHES+=("${FILESDIR}/chromium-001-widevine-support-for-arm.patch")
PATCHES+=(${FILESDIR}/chromium-001-widevine-support-for-arm.patch)
fi
if use system-toolchain; then
# The patchset is really only required if we're using the system-toolchain
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
else
mkdir -p third_party/llvm-build/Release+Asserts || die "Failed to bundle llvm"
ln -s "${WORKDIR}"/bin third_party/llvm-build/Release+Asserts/bin || die "Failed to symlink llvm bin"
ln -s "${WORKDIR}"/lib third_party/llvm-build/Release+Asserts/lib || die "Failed to symlink llvm lib"
echo "${GOOGLE_CLANG_VER}" > third_party/llvm-build/Release+Asserts/cr_build_revision || \
die "Failed to set clang version"
ln -s "${WORKDIR}"/rust-toolchain third_party/rust-toolchain || die "Failed to bundle rust"
cp "${WORKDIR}"/rust-toolchain/VERSION \
"${WORKDIR}"/rust-toolchain/INSTALLED_VERSION || die "Failed to set rust version"
fi
shopt -s globstar nullglob
# 130: moved the PPC64 patches into the chromium-patches repo
local patch
for patch in "${WORKDIR}/chromium-patches-${PATCH_V}"/**/*.patch; do
elog "Applying patch: ${patch}"
if [[ ${patch} == *"ppc64le"* ]]; then
use ppc64 && PATCHES+=( "${patch}" )
else
PATCHES+=( "${patch}" )
fi
done
if use ppc64 ; then
local p
for p in $(grep -v "^#" "${WORKDIR}"/debian/patches/series | grep "^ppc64le" || die); do
if [[ ! $p =~ "fix-breakpad-compile.patch" ]]; then
eapply "${WORKDIR}/debian/patches/${p}"
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
if use ppc64; then
# Above this level there are ungoogled-chromium patches that we can't apply
local patchset_dir="${WORKDIR}/openpower-patches-${PPC64_HASH}/patches/ppc64le"
# Apply the OpenPOWER patches
local power9_patch="patches/ppc64le/core/baseline-isa-3-0.patch"
for patch in ${patchset_dir}/**/*.{patch,diff}; do
if [[ ${patch} == *"${power9_patch}" ]]; then
use cpu_flags_ppc_vsx3 && PATCHES+=( "${patch}" )
else
PATCHES+=( "${patch}" )
fi
done
PATCHES+=( "${WORKDIR}/ppc64le" )
PATCHES+=( "${WORKDIR}/debian/patches/fixes/rust-clanglib.patch" )
PATCHES+=( "${WORKDIR}/openpower-patches-${PPC64_HASH}/patches/upstream/blink-fix-size-assertions.patch" )
fi
shopt -u globstar nullglob
default
rm third_party/node/linux/node-linux-x64/bin/node || die
@ -525,6 +423,8 @@ src_prepare() {
# adjust python interpreter version
sed -i -e "s|\(^script_executable = \).*|\1\"${EPYTHON}\"|g" .gn || die
# remove_bundled_libraries.py walks the source tree and looks for paths containing the substring 'third_party'
# whitelist matches use the right-most matching path component, so we need to whitelist from that point down.
local keeplibs=(
base/third_party/cityhash
base/third_party/double_conversion
@ -536,7 +436,6 @@ src_prepare() {
buildtools/third_party/libc++
buildtools/third_party/libc++abi
chrome/third_party/mozilla_security_manager
courgette/third_party
net/third_party/mozilla_security_manager
net/third_party/nss
net/third_party/quic
@ -607,6 +506,7 @@ src_prepare() {
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/parsel-js
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/rxjs
third_party/devtools-frontend/src/front_end/third_party/third-party-web
third_party/devtools-frontend/src/front_end/third_party/vscode.web-custom-data
third_party/devtools-frontend/src/front_end/third_party/wasmparser
third_party/devtools-frontend/src/front_end/third_party/web-vitals
@ -616,6 +516,7 @@ src_prepare() {
third_party/eigen3
third_party/emoji-segmenter
third_party/farmhash
third_party/fast_float
third_party/fdlibm
third_party/ffmpeg
third_party/fft2d
@ -781,6 +682,17 @@ src_prepare() {
third_party/xdg-utils
)
if use test; then
# tar tvf /var/cache/distfiles/${P}-testdata.tar.xz | grep '^d' | grep 'third_party' | awk '{print $NF}'
keeplibs+=(
third_party/google_benchmark/src/include/benchmark
third_party/google_benchmark/src/src
third_party/perfetto/protos/third_party/pprof
third_party/test_fonts
third_party/test_fonts/fontconfig
)
fi
# USE=system-*
if ! use system-harfbuzz; then
keeplibs+=( third_party/harfbuzz-ng )
@ -798,10 +710,6 @@ src_prepare() {
keeplibs+=( third_party/zstd )
fi
if ! use system-toolchain || [[ ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN} == yes ]]; then
keeplibs+=( third_party/llvm )
fi
# Arch-specific
if use arm64 || use ppc64 ; then
keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
@ -826,10 +734,38 @@ src_prepare() {
popd >/dev/null || die
fi
einfo "Unbundling third-party libraries ..."
# Sanity check keeplibs, on major version bumps it is often necessary to update this list
# and this enables us to hit them all at once.
# There are some entries that need to be whitelisted (TODO: Why? The file is understandable, the rest seem odd)
whitelist_libs=(
net/third_party/quic
third_party/devtools-frontend/src/front_end/third_party/additional_readme_paths.json
third_party/libjingle
third_party/mesa
third_party/skia/third_party/vulkan
third_party/vulkan
)
local not_found_libs=()
for lib in "${keeplibs[@]}"; do
if [[ ! -d "${lib}" ]] && ! has "${lib}" "${whitelist_libs[@]}"; then
not_found_libs+=( "${lib}" )
fi
done
if [[ ${#not_found_libs[@]} -gt 0 ]]; then
eerror "The following \`keeplibs\` directories were not found in the source tree:"
for lib in "${not_found_libs[@]}"; do
eerror " ${lib}"
done
die "Please update the ebuild."
fi
# Remove most bundled libraries. Some are still needed.
einfo "Unbundling third-party libraries ..."
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
# TODO: From 127 chromium includes a bunch of binaries? Unbundle them; they're not needed.
# bundled eu-strip is for amd64 only and we don't want to pre-stripped binaries
mkdir -p buildtools/third_party/eu-strip/bin || die
ln -s "${EPREFIX}"/bin/true buildtools/third_party/eu-strip/bin/eu-strip || die
@ -842,73 +778,64 @@ chromium_configure() {
local myconf_gn=""
# We already forced the "correct" clang via pkg_setup
if use system-toolchain; then
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
# from get_llvm_prefix
local prefix=${ESYSROOT}
[[ ${1} == -b ]] && prefix=${BROOT}
myconf_gn+=" bindgen_libclang_path=\"${prefix}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
# We need to provide this to GN in both the path to rust _and_ the version
local rustc_ver=$(chromium_extract_rust_version)
if [[ "$(eselect --brief rust show 2>/dev/null)" == *"bin"* ]]; then
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/opt/rust-bin-${rustc_ver}/\""
else
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/usr/lib/rust/${rustc_ver}/\""
fi
myconf_gn+=" rustc_version=\"${rustc_ver}\""
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
myconf_gn+=" bindgen_libclang_path=\"$(get_llvm_prefix)/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
# We need to provide this to GN in both the path to rust _and_ the version
myconf_gn+=" rust_sysroot_absolute=\"$(get_rust_prefix)\""
myconf_gn+=" rustc_version=\"${RUST_SLOT}\""
# GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
myconf_gn+=" is_debug=false"
@ -1142,20 +1069,6 @@ chromium_configure() {
use wayland && myconf_gn+=" use_system_libffi=true"
fi
# Results in undefined references in chrome linking, may require CFI to work
if use arm64; then
myconf_gn+=" arm_control_flow_integrity=\"none\""
fi
# 936673: Updater (which we don't use) depends on libsystemd
# This _should_ always be disabled if we're not building a
# "Chrome" branded browser, but obviously this is not always sufficient.
myconf_gn+=" enable_updater=false"
local use_lto="false"
if tc-is-lto; then
use_lto="true"
fi
myconf_gn+=" use_thin_lto=${use_lto}"
myconf_gn+=" thin_lto_enable_optimizations=${use_lto}"
@ -1165,10 +1078,7 @@ chromium_configure() {
# Allow building against system libraries in official builds
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
tools/generate_shim_headers/generate_shim_headers.py || die
# Req's LTO; TODO: not compatible with -fno-split-lto-unit
# split-lto-unit can be enabled with RUSTC_BOOTSTRAP=1 (and an updated compiler patch),
# however I still got weird linking errors with CFI _and_ the split unit LTO OOMed after using 100G.
myconf_gn+=" is_cfi=false"
myconf_gn+=" is_cfi=${use_lto}"
# Don't add symbols to build
myconf_gn+=" symbol_level=0"
fi
@ -1224,25 +1134,10 @@ chromium_compile() {
# Even though ninja autodetects number of CPUs, we respect
# user's options, for debugging with -j 1 or any other reason.
eninja -C out/Release chrome chromedriver chrome_sandbox
eninja -C out/Release chrome chromedriver chrome_sandbox $(use test && echo "base_unittests")
pax-mark m out/Release/chrome
if ! use system-toolchain; then
QA_FLAGS_IGNORED="
usr/lib64/chromium-browser/chrome
usr/lib64/chromium-browser/chrome-sandbox
usr/lib64/chromium-browser/chromedriver
usr/lib64/chromium-browser/chrome_crashpad_handler
usr/lib64/chromium-browser/libEGL.so
usr/lib64/chromium-browser/libGLESv2.so
usr/lib64/chromium-browser/libVkICD_mock_icd.so
usr/lib64/chromium-browser/libVkLayer_khronos_validation.so
usr/lib64/chromium-browser/libqt5_shim.so
usr/lib64/chromium-browser/libvk_swiftshader.so
usr/lib64/chromium-browser/libvulkan.so.1
"
fi
}
# This function is called from virtx, and must always return so that Xvfb
@ -1321,6 +1216,56 @@ src_compile() {
out/Release/vk_swiftshader_icd.json || die
}
src_test() {
# Initial list of tests to skip pulled from Alpine. Thanks Lauren!
# https://issues.chromium.org/issues/40939315
local skip_tests=(
'MessagePumpLibeventTest.NestedNotification*'
ClampTest.Death
OptionalTest.DereferencingNoValueCrashes
PlatformThreadTest.SetCurrentThreadTypeTest
RawPtrTest.TrivialRelocability
SafeNumerics.IntMaxOperations
StackTraceTest.TraceStackFramePointersFromBuffer
StringPieceTest.InvalidLengthDeath
StringPieceTest.OutOfBoundsDeath
ThreadPoolEnvironmentConfig.CanUseBackgroundPriorityForWorker
ValuesUtilTest.FilePath
# Gentoo-specific
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/3
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/3
CharacterEncodingTest.GetCanonicalEncodingNameByAliasName
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGFPE
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGILL
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGV
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGVNonCanonicalAddress
FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe
ICUStringConversionsTest.ConvertToUtf8AndNormalize
NumberFormattingTest.FormatPercent
PathServiceTest.CheckedGetFailure
PlatformThreadTest.CanChangeThreadType
StackCanary.ChangingStackCanaryCrashesOnReturn
StackTraceDeathTest.StackDumpSignalHandlerIsMallocFree
SysStrings.SysNativeMBAndWide
SysStrings.SysNativeMBToWide
SysStrings.SysWideToNativeMB
TestLauncherTools.TruncateSnippetFocusedMatchesFatalMessagesTest
ToolsSanityTest.BadVirtualCallNull
ToolsSanityTest.BadVirtualCallWrongType
)
local test_filter="-$(IFS=:; printf '%s' "${skip_tests[*]}")"
# test-launcher-bot-mode enables parallelism and plain output
./out/Release/base_unittests --test-launcher-bot-mode \
--test-launcher-jobs="$(makeopts_jobs)" \
--gtest_filter="${test_filter}" || die "Tests failed!"
}
src_install() {
local CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
exeinto "${CHROMIUM_HOME}"

View file

@ -5,73 +5,40 @@ EAPI=8
# PACKAGING NOTES
# Google roll their bundled Clang every two weeks, and the bundled Rust
# is rolled regularly and depends on that. While we do our best to build
# with system Clang, we will eventually hit the point where we need to use
# the bundled Clang due to the use of prerelease features. We've been lucky
# enough so far that this hasn't been an issue.
# We use llvm-utils.eclass directly due to chromium's inherent Googliness.
# GN is bundled with Chromium, but we always use the system version. Remember to
# check for upstream changes to GN and update ebuild (and version below) as required.
# For binhost users, if USE=bindist is set, we configure Chromium in a way that it is able
# to use proprietary codecs, and so that ffmpeg is an external component (libffmpeg.so),
# then we remove ffmpeg from the image to ensure that the built package is distributable
# (i.e. we don't owe royalties). A suitable libffmpeg.so is symlinked in its place;
# as a result of this, ffmpeg[chromium] or ffmpeg-chromium must be installed on the system.
# For non-binhost builds, we build the bundled ffmpeg and enable proprietary codecs because there's
# no reason not to. Todo: Re-enable USE=system-ffmpeg.
# This uses a gentoo-created tarball due to Google CI Failures.
# Use 133(?) as a base for new official tarballs.
GN_MIN_VER=0.2165
RUST_MIN_VER=1.78.0
# chromium-tools/get-chromium-toolchain-strings.sh
GOOGLE_CLANG_VER=llvmorg-20-init-3847-g69c43468-28
GOOGLE_RUST_VER=009e73825af0e59ad4fc603562e038b3dbd6593a-2
# TODO: Roll into toolchain-strings script.
# in DEPS file -> deps['src/third_party/test_fonts']['objects'][0]['object_name']
# chromium-tools/get-chromium-toolchain-strings.py
TEST_FONT=f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35
: ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN=no}
VIRTUALX_REQUIRED="pgo"
CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
sv sw ta te th tr uk ur vi zh-CN zh-TW"
# While prerelease llvm is actually used in the google build, until we have a
# sane way to select 'rust built with this llvm slot' that isn't stable and testing
# subslots we will have to restrict LLVM_COMPAT to stable and testing keywords.
LLVM_COMPAT=( 17 18 )
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{11..13} )
PYTHON_REQ_USE="xml(+)"
RUST_MIN_VER=1.78.0
RUST_NEEDS_LLVM="yes please"
inherit check-reqs chromium-2 desktop flag-o-matic llvm-utils multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 systemd toolchain-funcs virtualx xdg-utils
inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 rust systemd toolchain-funcs virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="https://www.chromium.org/"
PATCHSET_PPC64="128.0.6613.84-1raptor0~deb12u1"
PPC64_HASH="a85b64f07b489b8c6fdb13ecf79c16c56c560fc6"
PATCH_V="${PV%%\.*}-1"
SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
system-toolchain? (
SRC_URI="https://chromium-tarballs.distfiles.gentoo.org/${P}-linux.tar.xz
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2
)
!system-toolchain? (
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-${GOOGLE_CLANG_VER}.tar.xz
-> chromium-${PV%%\.*}-clang.tar.xz
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/rust-toolchain-${GOOGLE_RUST_VER}-${GOOGLE_CLANG_VER%???}.tar.xz
-> chromium-${PV%%\.*}-rust.tar.xz
)
test? (
https://commondatastorage.googleapis.com/chromium-browser-official/${P}-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-${PV%%\.*}-testfonts.tar.gz
)
https://chromium-tarballs.distfiles.gentoo.org/${P}-linux-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz
)
ppc64? (
https://quickbuild.io/~raptor-engineering-public/+archive/ubuntu/chromium/+files/chromium_${PATCHSET_PPC64}.debian.tar.xz
https://deps.gentoo.zip/chromium-ppc64le-gentoo-patches-1.tar.xz
https://gitlab.solidsilicon.io/public-development/open-source/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
)
pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
@ -79,15 +46,13 @@ LICENSE="BSD"
SLOT="0/stable"
# Dev exists mostly to give devs some breathing room for beta/stable releases;
# it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} == "0/dev" ]]; then
KEYWORDS="~arm64"
else
KEYWORDS="~arm64"
if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="arm64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo +proprietary-codecs pulseaudio"
IUSE+=" qt5 qt6 +screencast selinux +system-toolchain test +vaapi +wayland +widevine"
IUSE+=" qt5 qt6 +screencast selinux test +vaapi +wayland +widevine"
RESTRICT="
!bindist? ( bindist )
!test? ( test )
@ -199,29 +164,6 @@ DEPEND="${COMMON_DEPEND}
)
"
depend_clang_llvm_version() {
echo "sys-devel/clang:$1"
echo "sys-devel/llvm:$1"
echo "=sys-devel/lld-$1*"
echo "virtual/rust:0/llvm-${1}[profiler(-)]"
echo "pgo? ( sys-libs/compiler-rt-sanitizers:${1}[profile] )"
}
# Parse LLVM_COMPAT and generate a usedep for each version
depend_clang_llvm_versions() {
if [[ ${#LLVM_COMPAT[@]} -eq 0 ]]; then
depend_clang_llvm_version ${#LLVM_COMPAT[0]}
else
echo "|| ("
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
echo "("
depend_clang_llvm_version ${LLVM_COMPAT[i]}
echo ")"
done
echo ")"
fi
}
BDEPEND="
${COMMON_SNAPSHOT_DEPEND}
${PYTHON_DEPS}
@ -233,14 +175,16 @@ BDEPEND="
qt5? ( dev-qt/qtcore:5 )
qt6? ( dev-qt/qtbase:6 )
)
system-toolchain? (
$(depend_clang_llvm_versions)
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
llvm-core/llvm:${LLVM_SLOT}
llvm-core/lld:${LLVM_SLOT}
')
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
>=dev-build/gn-${GN_MIN_VER}
dev-build/ninja
dev-lang/perl
@ -330,144 +274,62 @@ pkg_pretend() {
fi
}
# Chromium should build with any version of clang that we support
# but we may need to pick the "best" one for a build (highest installed,
# rust is built against it, etc.)
# Check each slot in LLVM_COMPAT to see if clang/llvm/lld are available
# and output the _highest_ slot that is actually available on a system.
chromium_pick_llvm_slot() {
# LLVM_COMPAT is always going to be oldest to newest (or one value)
# let's flip it and check from newest to oldest and return the first one we find.
local slot
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
slot=${LLVM_COMPAT[i]}
if has_version "sys-devel/clang:${slot}" && \
has_version "sys-devel/llvm:${slot}" && \
has_version "sys-devel/lld:${slot}" && \
has_version "virtual/rust:0/llvm-${slot}" && \
( ! use pgo || has_version "sys-libs/compiler-rt-sanitizers:${slot}" ) ; then
echo "${slot}"
return
fi
done
die_msg="
No suitable clang/llvm/lld slot found.
Slots checked: ${LLVM_COMPAT[*]}.
"
die "${die_msg}"
}
# We need the rust version in src_configure and pkg_setup
chromium_extract_rust_version() {
[[ ${MERGE_TYPE} == binary ]] && return
local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
rustc_version=${rustc_version[0]#rust-bin-}
rustc_version=${rustc_version#rust-}
[[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
echo $rustc_version
}
pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]]; then
# The pre_build_checks are all about compilation resources, no need to run it for a binpkg
pre_build_checks
if use system-toolchain; then
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
LLVM_SLOT=$(chromium_pick_llvm_slot)
export LLVM_SLOT # used in src_configure for rust-y business
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
fi
# The llvm-r1_pkg_setup we have at home.
# We prepend the path _first_ to explicitly use the selected slot.
llvm_prepend_path "${LLVM_SLOT}"
llvm_fix_clang_version CC CPP CXX
llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB
llvm_fix_tool_path READELF STRINGS STRIP
# Set LLVM_CONFIG to help Meson (bug #907965) but only do it
# for empty ESYSROOT (as a proxy for "are we cross-compiling?").
if [[ -z ${ESYSROOT} ]] ; then
llvm_fix_tool_path LLVM_CONFIG
fi
einfo "Using LLVM/Clang slot ${LLVM_SLOT} to build"
local rustc_ver=$(chromium_extract_rust_version)
if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
eerror "Rust >=${RUST_MIN_VER} is required to build Chromium"
eerror "The currently selected version is ${rustc_ver}"
eerror "Please run \`eselect rust\` and select an appropriate Rust."
die "Selected Rust version is too old"
else
einfo "Using Rust ${rustc_ver} to build"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Chromium requires the Rust profiler library while setting up its build environment.
# Since a standard Rust comes with the profiler, instead of patching it out (build/rust/std/BUILD.gn#L103)
# we'll just do a sanity check on the selected slot.
# The -bin always contains profiler support, so we only need to check for the non-bin version.
if [[ "$(eselect --brief rust show 2>/dev/null)" != *"bin"* ]]; then
local rust_lib_path="${EPREFIX}$(rustc --print target-libdir)"
local profiler_lib=$(find "${rust_lib_path}" -name "libprofiler_builtins-*.rlib" -print -quit)
if [[ -z "${profiler_lib}" ]]; then
eerror "Rust ${rustc_ver} is missing the profiler library."
eerror "ebuild dependency resolution should have ensured that a Rust with the profiler was installed."
die "Please \`eselect\` a Rust slot that has the profiler."
fi
fi
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Users should never hit this, it's purely a development convenience
if ver_test $(gn --version || die) -lt ${GN_MIN_VER}; then
die "dev-build/gn >= ${GN_MIN_VER} is required to build this Chromium"
@ -478,20 +340,8 @@ pkg_setup() {
}
src_unpack() {
# In 126 Chromium upstream decided to change the way that the rust toolchain is packaged
# so now we get a fancy src_unpack function to ensure that we don't accidentally unpack
# one toolchain over the other. The addtional control over over unpacking also helps us
# ensure that GN doesn't try and use some bundled tool (like bindgen) instead of the system
# package by just not unpacking it unless we're using the bundled toolchain.
unpack ${P}.tar.xz
if use system-toolchain; then
unpack chromium-patches-${PATCH_V}.tar.bz2
else
unpack chromium-${PV%%\.*}-clang.tar.xz
local rust_dir="${WORKDIR}/rust-toolchain"
mkdir -p ${rust_dir} || die "Failed to create rust toolchain directory"
tar xf "${DISTDIR}/chromium-${PV%%\.*}-rust.tar.xz" -C "${rust_dir}" || die "Failed to unpack rust toolchain"
fi
unpack ${P}-linux.tar.xz
unpack chromium-patches-${PATCH_V}.tar.bz2
use pgo && unpack chromium-profiler-0.2.tar
@ -499,15 +349,15 @@ src_unpack() {
# A new testdata tarball is available for each release; but testfonts tend to remain stable
# for the duration of a release.
# This unpacks directly into/over ${WORKDIR}/${P} so we can just use `unpack`.
unpack ${P}-testdata.tar.xz
unpack ${P}-linux-testdata.tar.xz
# This just contains a bunch of font files that need to be unpacked (or moved) to the correct location.
local testfonts_dir="${WORKDIR}/${P}/third_party/test_fonts"
tar xf "${DISTDIR}/${P%%\.*}-testfonts.tar.gz" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
local testfonts_tar="${DISTDIR}/chromium-testfonts-${TEST_FONT:0:10}.tar.gz"
tar xf "${testfonts_tar}" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
fi
if use ppc64; then
unpack chromium_${PATCHSET_PPC64}.debian.tar.xz
unpack chromium-ppc64le-gentoo-patches-1.tar.xz
unpack chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
fi
}
@ -524,33 +374,23 @@ src_prepare() {
"${FILESDIR}/chromium-cross-compile.patch"
"${FILESDIR}/chromium-109-system-zlib.patch"
"${FILESDIR}/chromium-111-InkDropHost-crash.patch"
"${FILESDIR}/chromium-126-oauth2-client-switches.patch"
"${FILESDIR}/chromium-127-bindgen-custom-toolchain.patch"
"${FILESDIR}/chromium-131-unbundle-icu-target.patch"
"${FILESDIR}/chromium-131-oauth2-client-switches.patch"
"${FILESDIR}/chromium-131-const-atomicstring-conversion.patch"
)
if use widevine; then
PATCHES+=("${FILESDIR}/chromium-001-widevine-support-for-arm.patch")
PATCHES+=(${FILESDIR}/chromium-001-widevine-support-for-arm.patch)
fi
if use system-toolchain; then
# The patchset is really only required if we're using the system-toolchain
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
else
mkdir -p third_party/llvm-build/Release+Asserts || die "Failed to bundle llvm"
ln -s "${WORKDIR}"/bin third_party/llvm-build/Release+Asserts/bin || die "Failed to symlink llvm bin"
ln -s "${WORKDIR}"/lib third_party/llvm-build/Release+Asserts/lib || die "Failed to symlink llvm lib"
echo "${GOOGLE_CLANG_VER}" > third_party/llvm-build/Release+Asserts/cr_build_revision || \
die "Failed to set clang version"
ln -s "${WORKDIR}"/rust-toolchain third_party/rust-toolchain || die "Failed to bundle rust"
cp "${WORKDIR}"/rust-toolchain/VERSION \
"${WORKDIR}"/rust-toolchain/INSTALLED_VERSION || die "Failed to set rust version"
fi
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
if use ppc64 ; then
local p
@ -646,9 +486,9 @@ src_prepare() {
third_party/devtools-frontend/src/front_end/third_party/diff
third_party/devtools-frontend/src/front_end/third_party/i18n
third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
third_party/devtools-frontend/src/front_end/third_party/json5
third_party/devtools-frontend/src/front_end/third_party/lighthouse
third_party/devtools-frontend/src/front_end/third_party/lit
third_party/devtools-frontend/src/front_end/third_party/lodash-isequal
third_party/devtools-frontend/src/front_end/third_party/marked
third_party/devtools-frontend/src/front_end/third_party/puppeteer
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt
@ -681,6 +521,17 @@ src_prepare() {
third_party/highway
third_party/hunspell
third_party/iccjpeg
third_party/ink_stroke_modeler/src/ink_stroke_modeler
third_party/ink_stroke_modeler/src/ink_stroke_modeler/internal
third_party/ink/src/ink/brush
third_party/ink/src/ink/color
third_party/ink/src/ink/geometry
third_party/ink/src/ink/rendering
third_party/ink/src/ink/rendering/skia/common_internal
third_party/ink/src/ink/rendering/skia/native
third_party/ink/src/ink/rendering/skia/native/internal
third_party/ink/src/ink/strokes
third_party/ink/src/ink/types
third_party/inspector_protocol
third_party/ipcz
third_party/jinja2
@ -791,8 +642,10 @@ src_prepare() {
third_party/tflite/src/third_party/eigen3
third_party/tflite/src/third_party/fft2d
third_party/tflite/src/third_party/xla/third_party/tsl
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/tflite/src/third_party/xla/xla/tsl/framework
third_party/tflite/src/third_party/xla/xla/tsl/lib/random
third_party/tflite/src/third_party/xla/xla/tsl/protobuf
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/ukey2
third_party/unrar
third_party/utf
@ -833,10 +686,6 @@ src_prepare() {
if use test; then
# tar tvf /var/cache/distfiles/${P}-testdata.tar.xz | grep '^d' | grep 'third_party' | awk '{print $NF}'
keeplibs+=(
chrome/test/data/third_party
content/test/data/gpu/third_party
third_party/breakpad/breakpad/src/processor/testdata/symbols
third_party/catapult/tracing/test_data
third_party/google_benchmark/src/include/benchmark
third_party/google_benchmark/src/src
third_party/perfetto/protos/third_party/pprof
@ -862,10 +711,6 @@ src_prepare() {
keeplibs+=( third_party/zstd )
fi
if ! use system-toolchain || [[ ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN} == yes ]]; then
keeplibs+=( third_party/llvm )
fi
# Arch-specific
if use arm64 || use ppc64 ; then
keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
@ -934,73 +779,63 @@ chromium_configure() {
local myconf_gn=""
# We already forced the "correct" clang via pkg_setup
if use system-toolchain; then
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
# from get_llvm_prefix
local prefix=${ESYSROOT}
[[ ${1} == -b ]] && prefix=${BROOT}
myconf_gn+=" bindgen_libclang_path=\"${prefix}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
# We need to provide this to GN in both the path to rust _and_ the version
local rustc_ver=$(chromium_extract_rust_version)
if [[ "$(eselect --brief rust show 2>/dev/null)" == *"bin"* ]]; then
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/opt/rust-bin-${rustc_ver}/\""
else
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/usr/lib/rust/${rustc_ver}/\""
fi
myconf_gn+=" rustc_version=\"${rustc_ver}\""
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
myconf_gn+=" bindgen_libclang_path=\"$(get_llvm_prefix)/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
myconf_gn+=" rust_sysroot_absolute=\"$(get_rust_prefix)\""
myconf_gn+=" rustc_version=\"${RUST_SLOT}\""
# GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
myconf_gn+=" is_debug=false"
@ -1049,6 +884,13 @@ chromium_configure() {
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
# TODO 131: The above call clobbers `enable_freetype = true` in the freetype gni file
# drop the last line, then append the freetype line and a new curly brace to end the block
local freetype_gni="build/config/freetype/freetype.gni"
sed -i -e '$d' ${freetype_gni} || die
echo " enable_freetype = true" >> ${freetype_gni} || die
echo "}" >> ${freetype_gni} || die
# See dependency logic in third_party/BUILD.gn
myconf_gn+=" use_system_harfbuzz=$(usex system-harfbuzz true false)"
@ -1189,6 +1031,11 @@ chromium_configure() {
# Don't need nocompile checks and GN crashes with our config
myconf_gn+=" enable_nocompile_tests=false"
# 131 began laying the groundwork for replacing freetype with
# "Rust-based Fontations set of libraries plus Skia path rendering"
# We now need to opt-in
myconf_gn+=" enable_freetype=true"
# Enable ozone wayland and/or headless support
myconf_gn+=" use_ozone=true ozone_auto_platforms=false"
myconf_gn+=" ozone_platform_headless=true"
@ -1274,6 +1121,7 @@ src_configure() {
}
chromium_compile() {
# Final link uses lots of file descriptors.
ulimit -n 2048
@ -1303,21 +1151,6 @@ chromium_compile() {
pax-mark m out/Release/chrome
if ! use system-toolchain; then
QA_FLAGS_IGNORED="
usr/lib64/chromium-browser/chrome
usr/lib64/chromium-browser/chrome-sandbox
usr/lib64/chromium-browser/chromedriver
usr/lib64/chromium-browser/chrome_crashpad_handler
usr/lib64/chromium-browser/libEGL.so
usr/lib64/chromium-browser/libGLESv2.so
usr/lib64/chromium-browser/libVkICD_mock_icd.so
usr/lib64/chromium-browser/libVkLayer_khronos_validation.so
usr/lib64/chromium-browser/libqt5_shim.so
usr/lib64/chromium-browser/libvk_swiftshader.so
usr/lib64/chromium-browser/libvulkan.so.1
"
fi
}
# This function is called from virtx, and must always return so that Xvfb
@ -1411,6 +1244,34 @@ src_test() {
StringPieceTest.OutOfBoundsDeath
ThreadPoolEnvironmentConfig.CanUseBackgroundPriorityForWorker
ValuesUtilTest.FilePath
# Gentoo-specific
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/3
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/3
CharacterEncodingTest.GetCanonicalEncodingNameByAliasName
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGFPE
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGILL
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGV
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGVNonCanonicalAddress
FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe
FileTest.GetInfoForCreationTime
ICUStringConversionsTest.ConvertToUtf8AndNormalize
NumberFormattingTest.FormatPercent
PathServiceTest.CheckedGetFailure
PlatformThreadTest.CanChangeThreadType
StackCanary.ChangingStackCanaryCrashesOnReturn
StackTraceDeathTest.StackDumpSignalHandlerIsMallocFree
SysStrings.SysNativeMBAndWide
SysStrings.SysNativeMBToWide
SysStrings.SysWideToNativeMB
TestLauncherTools.TruncateSnippetFocusedMatchesFatalMessagesTest
ToolsSanityTest.BadVirtualCallNull
ToolsSanityTest.BadVirtualCallWrongType
)
local test_filter="-$(IFS=:; printf '%s' "${skip_tests[*]}")"
# test-launcher-bot-mode enables parallelism and plain output

View file

@ -5,71 +5,40 @@ EAPI=8
# PACKAGING NOTES
# Google roll their bundled Clang every two weeks, and the bundled Rust
# is rolled regularly and depends on that. While we do our best to build
# with system Clang, we will eventually hit the point where we need to use
# the bundled Clang due to the use of prerelease features. We've been lucky
# enough so far that this hasn't been an issue.
# We use llvm-utils.eclass directly due to chromium's inherent Googliness.
# GN is bundled with Chromium, but we always use the system version. Remember to
# check for upstream changes to GN and update ebuild (and version below) as required.
# For binhost users, if USE=bindist is set, we configure Chromium in a way that it is able
# to use proprietary codecs, and so that ffmpeg is an external component (libffmpeg.so),
# then we remove ffmpeg from the image to ensure that the built package is distributable
# (i.e. we don't owe royalties). A suitable libffmpeg.so is symlinked in its place;
# as a result of this, ffmpeg[chromium] or ffmpeg-chromium must be installed on the system.
# For non-binhost builds, we build the bundled ffmpeg and enable proprietary codecs because there's
# no reason not to. Todo: Re-enable USE=system-ffmpeg.
# This uses a gentoo-created tarball due to Google CI Failures.
# Use 133(?) as a base for new official tarballs.
GN_MIN_VER=0.2165
RUST_MIN_VER=1.78.0
# chromium-tools/get-chromium-toolchain-strings.py
GOOGLE_CLANG_VER=llvmorg-20-init-3847-g69c43468-28
GOOGLE_RUST_VER=009e73825af0e59ad4fc603562e038b3dbd6593a-2
TEST_FONT=f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35
: ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN=no}
VIRTUALX_REQUIRED="pgo"
CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
sv sw ta te th tr uk ur vi zh-CN zh-TW"
# While prerelease llvm is actually used in the google build, until we have a
# sane way to select 'rust built with this llvm slot' that isn't stable and testing
# subslots we will have to restrict LLVM_COMPAT to stable and testing keywords.
LLVM_COMPAT=( {17..19} )
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{11..13} )
PYTHON_REQ_USE="xml(+)"
RUST_MIN_VER=1.78.0
RUST_NEEDS_LLVM="yes please"
inherit check-reqs chromium-2 desktop flag-o-matic llvm-utils multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 systemd toolchain-funcs virtualx xdg-utils
inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 rust systemd toolchain-funcs virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="https://www.chromium.org/"
PATCHSET_PPC64="128.0.6613.84-1raptor0~deb12u1"
PPC64_HASH="a85b64f07b489b8c6fdb13ecf79c16c56c560fc6"
PATCH_V="${PV%%\.*}-1"
SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
system-toolchain? (
SRC_URI="https://chromium-tarballs.distfiles.gentoo.org/${P}-linux.tar.xz
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2
)
!system-toolchain? (
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-${GOOGLE_CLANG_VER}.tar.xz
-> chromium-${PV%%\.*}-clang.tar.xz
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/rust-toolchain-${GOOGLE_RUST_VER}-${GOOGLE_CLANG_VER%???}.tar.xz
-> chromium-${PV%%\.*}-rust.tar.xz
)
test? (
https://commondatastorage.googleapis.com/chromium-browser-official/${P}-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-${PV%%\.*}-testfonts.tar.gz
)
https://chromium-tarballs.distfiles.gentoo.org/${P}-linux-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz
)
ppc64? (
https://quickbuild.io/~raptor-engineering-public/+archive/ubuntu/chromium/+files/chromium_${PATCHSET_PPC64}.debian.tar.xz
https://deps.gentoo.zip/chromium-ppc64le-gentoo-patches-1.tar.xz
https://gitlab.solidsilicon.io/public-development/open-source/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
)
pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
@ -77,15 +46,13 @@ LICENSE="BSD"
SLOT="0/stable"
# Dev exists mostly to give devs some breathing room for beta/stable releases;
# it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} == "0/dev" ]]; then
KEYWORDS="~arm64"
else
if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="~arm64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo +proprietary-codecs pulseaudio"
IUSE+=" qt5 qt6 +screencast selinux +system-toolchain test +vaapi +wayland +widevine"
IUSE+=" qt5 qt6 +screencast selinux test +vaapi +wayland +widevine"
RESTRICT="
!bindist? ( bindist )
!test? ( test )
@ -197,29 +164,6 @@ DEPEND="${COMMON_DEPEND}
)
"
depend_clang_llvm_version() {
echo "sys-devel/clang:$1"
echo "sys-devel/llvm:$1"
echo "=sys-devel/lld-$1*"
echo "virtual/rust:0/llvm-${1}[profiler(-)]"
echo "pgo? ( sys-libs/compiler-rt-sanitizers:${1}[profile] )"
}
# Parse LLVM_COMPAT and generate a usedep for each version
depend_clang_llvm_versions() {
if [[ ${#LLVM_COMPAT[@]} -eq 0 ]]; then
depend_clang_llvm_version ${#LLVM_COMPAT[0]}
else
echo "|| ("
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
echo "("
depend_clang_llvm_version ${LLVM_COMPAT[i]}
echo ")"
done
echo ")"
fi
}
BDEPEND="
${COMMON_SNAPSHOT_DEPEND}
${PYTHON_DEPS}
@ -231,14 +175,16 @@ BDEPEND="
qt5? ( dev-qt/qtcore:5 )
qt6? ( dev-qt/qtbase:6 )
)
system-toolchain? (
$(depend_clang_llvm_versions)
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
llvm-core/llvm:${LLVM_SLOT}
llvm-core/lld:${LLVM_SLOT}
')
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
>=dev-build/gn-${GN_MIN_VER}
dev-build/ninja
dev-lang/perl
@ -328,146 +274,62 @@ pkg_pretend() {
fi
}
# Chromium should build with any version of clang that we support
# but we may need to pick the "best" one for a build (highest installed,
# rust is built against it, etc.)
# Check each slot in LLVM_COMPAT to see if clang/llvm/lld are available
# and output the _highest_ slot that is actually available on a system.
chromium_pick_llvm_slot() {
# LLVM_COMPAT is always going to be oldest to newest (or one value)
# let's flip it and check from newest to oldest and return the first one we find.
local slot
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
slot=${LLVM_COMPAT[i]}
if has_version "sys-devel/clang:${slot}" && \
has_version "sys-devel/llvm:${slot}" && \
has_version "sys-devel/lld:${slot}" && \
has_version "virtual/rust:0/llvm-${slot}" && \
( ! use pgo || has_version "sys-libs/compiler-rt-sanitizers:${slot}" ) ; then
echo "${slot}"
return
fi
done
die_msg="
No suitable clang/llvm/lld slot found.
Slots checked: ${LLVM_COMPAT[*]}.
"
die "${die_msg}"
}
# We need the rust version in src_configure and pkg_setup
chromium_extract_rust_version() {
[[ ${MERGE_TYPE} == binary ]] && return
local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
rustc_version=${rustc_version[0]#rust-bin-}
rustc_version=${rustc_version#rust-}
[[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
echo $rustc_version
}
pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]]; then
# The pre_build_checks are all about compilation resources, no need to run it for a binpkg
pre_build_checks
if use system-toolchain; then
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
LLVM_SLOT=$(chromium_pick_llvm_slot)
export LLVM_SLOT # used in src_configure for rust-y business
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
fi
# The llvm-r1_pkg_setup we have at home.
# We prepend the path _first_ to explicitly use the selected slot.
llvm_prepend_path "${LLVM_SLOT}"
llvm_fix_clang_version CC CPP CXX
llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB
llvm_fix_tool_path READELF STRINGS STRIP
# Set LLVM_CONFIG to help Meson (bug #907965) but only do it
# for empty ESYSROOT (as a proxy for "are we cross-compiling?").
if [[ -z ${ESYSROOT} ]] ; then
llvm_fix_tool_path LLVM_CONFIG
fi
einfo "Using LLVM/Clang slot ${LLVM_SLOT} to build"
rustc_ver=$(chromium_extract_rust_version)
if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
eerror "Rust >=${RUST_MIN_VER} is required to build Chromium"
eerror "The currently selected version is ${rustc_ver}"
eerror "Please run \`eselect rust\` and select an appropriate Rust."
die "Selected Rust version is too old"
else
einfo "Using Rust ${rustc_ver} to build"
fi
export rustc_ver # used in src_configure, may as well avoid calling it again
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Chromium requires the Rust profiler library while setting up its build environment.
# Since a standard Rust comes with the profiler, instead of patching it out (build/rust/std/BUILD.gn#L103)
# we'll just do a sanity check on the selected slot.
# The -bin always contains profiler support, so we only need to check for the non-bin version.
if [[ "$(eselect --brief rust show 2>/dev/null)" != *"bin"* ]]; then
local rust_lib_path="${EPREFIX}$(rustc --print target-libdir)"
local profiler_lib=$(find "${rust_lib_path}" -name "libprofiler_builtins-*.rlib" -print -quit)
if [[ -z "${profiler_lib}" ]]; then
eerror "Rust ${rustc_ver} is missing the profiler library."
eerror "ebuild dependency resolution should have ensured that a Rust with the profiler was installed."
die "Please \`eselect\` a Rust slot that has the profiler."
fi
fi
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Users should never hit this, it's purely a development convenience
if ver_test $(gn --version || die) -lt ${GN_MIN_VER}; then
die "dev-build/gn >= ${GN_MIN_VER} is required to build this Chromium"
@ -478,20 +340,8 @@ pkg_setup() {
}
src_unpack() {
# In 126 Chromium upstream decided to change the way that the rust toolchain is packaged
# so now we get a fancy src_unpack function to ensure that we don't accidentally unpack
# one toolchain over the other. The addtional control over over unpacking also helps us
# ensure that GN doesn't try and use some bundled tool (like bindgen) instead of the system
# package by just not unpacking it unless we're using the bundled toolchain.
unpack ${P}.tar.xz
if use system-toolchain; then
unpack chromium-patches-${PATCH_V}.tar.bz2
else
unpack chromium-${PV%%\.*}-clang.tar.xz
local rust_dir="${WORKDIR}/rust-toolchain"
mkdir -p ${rust_dir} || die "Failed to create rust toolchain directory"
tar xf "${DISTDIR}/chromium-${PV%%\.*}-rust.tar.xz" -C "${rust_dir}" || die "Failed to unpack rust toolchain"
fi
unpack ${P}-linux.tar.xz
unpack chromium-patches-${PATCH_V}.tar.bz2
use pgo && unpack chromium-profiler-0.2.tar
@ -499,15 +349,15 @@ src_unpack() {
# A new testdata tarball is available for each release; but testfonts tend to remain stable
# for the duration of a release.
# This unpacks directly into/over ${WORKDIR}/${P} so we can just use `unpack`.
unpack ${P}-testdata.tar.xz
unpack ${P}-linux-testdata.tar.xz
# This just contains a bunch of font files that need to be unpacked (or moved) to the correct location.
local testfonts_dir="${WORKDIR}/${P}/third_party/test_fonts"
tar xf "${DISTDIR}/${P%%\.*}-testfonts.tar.gz" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
local testfonts_tar="${DISTDIR}/chromium-testfonts-${TEST_FONT:0:10}.tar.gz"
tar xf "${testfonts_tar}" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
fi
if use ppc64; then
unpack chromium_${PATCHSET_PPC64}.debian.tar.xz
unpack chromium-ppc64le-gentoo-patches-1.tar.xz
unpack chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
fi
}
@ -524,33 +374,23 @@ src_prepare() {
"${FILESDIR}/chromium-cross-compile.patch"
"${FILESDIR}/chromium-109-system-zlib.patch"
"${FILESDIR}/chromium-111-InkDropHost-crash.patch"
"${FILESDIR}/chromium-126-oauth2-client-switches.patch"
"${FILESDIR}/chromium-127-bindgen-custom-toolchain.patch"
"${FILESDIR}/chromium-131-unbundle-icu-target.patch"
"${FILESDIR}/chromium-131-oauth2-client-switches.patch"
"${FILESDIR}/chromium-131-const-atomicstring-conversion.patch"
)
if use widevine; then
PATCHES+=("${FILESDIR}/chromium-001-widevine-support-for-arm.patch")
PATCHES+=(${FILESDIR}/chromium-001-widevine-support-for-arm.patch)
fi
if use system-toolchain; then
# The patchset is really only required if we're using the system-toolchain
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
else
mkdir -p third_party/llvm-build/Release+Asserts || die "Failed to bundle llvm"
ln -s "${WORKDIR}"/bin third_party/llvm-build/Release+Asserts/bin || die "Failed to symlink llvm bin"
ln -s "${WORKDIR}"/lib third_party/llvm-build/Release+Asserts/lib || die "Failed to symlink llvm lib"
echo "${GOOGLE_CLANG_VER}" > third_party/llvm-build/Release+Asserts/cr_build_revision || \
die "Failed to set clang version"
ln -s "${WORKDIR}"/rust-toolchain third_party/rust-toolchain || die "Failed to bundle rust"
cp "${WORKDIR}"/rust-toolchain/VERSION \
"${WORKDIR}"/rust-toolchain/INSTALLED_VERSION || die "Failed to set rust version"
fi
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
if use ppc64 ; then
local p
@ -646,9 +486,9 @@ src_prepare() {
third_party/devtools-frontend/src/front_end/third_party/diff
third_party/devtools-frontend/src/front_end/third_party/i18n
third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
third_party/devtools-frontend/src/front_end/third_party/json5
third_party/devtools-frontend/src/front_end/third_party/lighthouse
third_party/devtools-frontend/src/front_end/third_party/lit
third_party/devtools-frontend/src/front_end/third_party/lodash-isequal
third_party/devtools-frontend/src/front_end/third_party/marked
third_party/devtools-frontend/src/front_end/third_party/puppeteer
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt
@ -681,6 +521,17 @@ src_prepare() {
third_party/highway
third_party/hunspell
third_party/iccjpeg
third_party/ink_stroke_modeler/src/ink_stroke_modeler
third_party/ink_stroke_modeler/src/ink_stroke_modeler/internal
third_party/ink/src/ink/brush
third_party/ink/src/ink/color
third_party/ink/src/ink/geometry
third_party/ink/src/ink/rendering
third_party/ink/src/ink/rendering/skia/common_internal
third_party/ink/src/ink/rendering/skia/native
third_party/ink/src/ink/rendering/skia/native/internal
third_party/ink/src/ink/strokes
third_party/ink/src/ink/types
third_party/inspector_protocol
third_party/ipcz
third_party/jinja2
@ -791,8 +642,10 @@ src_prepare() {
third_party/tflite/src/third_party/eigen3
third_party/tflite/src/third_party/fft2d
third_party/tflite/src/third_party/xla/third_party/tsl
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/tflite/src/third_party/xla/xla/tsl/framework
third_party/tflite/src/third_party/xla/xla/tsl/lib/random
third_party/tflite/src/third_party/xla/xla/tsl/protobuf
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/ukey2
third_party/unrar
third_party/utf
@ -833,10 +686,6 @@ src_prepare() {
if use test; then
# tar tvf /var/cache/distfiles/${P}-testdata.tar.xz | grep '^d' | grep 'third_party' | awk '{print $NF}'
keeplibs+=(
chrome/test/data/third_party
content/test/data/gpu/third_party
third_party/breakpad/breakpad/src/processor/testdata/symbols
third_party/catapult/tracing/test_data
third_party/google_benchmark/src/include/benchmark
third_party/google_benchmark/src/src
third_party/perfetto/protos/third_party/pprof
@ -862,10 +711,6 @@ src_prepare() {
keeplibs+=( third_party/zstd )
fi
if ! use system-toolchain || [[ ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN} == yes ]]; then
keeplibs+=( third_party/llvm )
fi
# Arch-specific
if use arm64 || use ppc64 ; then
keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
@ -934,72 +779,63 @@ chromium_configure() {
local myconf_gn=""
# We already forced the "correct" clang via pkg_setup
if use system-toolchain; then
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
# from get_llvm_prefix
local prefix=${ESYSROOT}
[[ ${1} == -b ]] && prefix=${BROOT}
myconf_gn+=" bindgen_libclang_path=\"${prefix}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
# We need to provide this to GN in both the path to rust _and_ the version
if [[ "$(eselect --brief rust show 2>/dev/null)" == *"bin"* ]]; then
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/opt/rust-bin-${rustc_ver}/\""
else
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/usr/lib/rust/${rustc_ver}/\""
fi
myconf_gn+=" rustc_version=\"${rustc_ver}\""
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
myconf_gn+=" bindgen_libclang_path=\"$(get_llvm_prefix)/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
myconf_gn+=" rust_sysroot_absolute=\"$(get_rust_prefix)\""
myconf_gn+=" rustc_version=\"${RUST_SLOT}\""
# GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
myconf_gn+=" is_debug=false"
@ -1048,6 +884,13 @@ chromium_configure() {
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
# TODO 131: The above call clobbers `enable_freetype = true` in the freetype gni file
# drop the last line, then append the freetype line and a new curly brace to end the block
local freetype_gni="build/config/freetype/freetype.gni"
sed -i -e '$d' ${freetype_gni} || die
echo " enable_freetype = true" >> ${freetype_gni} || die
echo "}" >> ${freetype_gni} || die
# See dependency logic in third_party/BUILD.gn
myconf_gn+=" use_system_harfbuzz=$(usex system-harfbuzz true false)"
@ -1188,6 +1031,11 @@ chromium_configure() {
# Don't need nocompile checks and GN crashes with our config
myconf_gn+=" enable_nocompile_tests=false"
# 131 began laying the groundwork for replacing freetype with
# "Rust-based Fontations set of libraries plus Skia path rendering"
# We now need to opt-in
myconf_gn+=" enable_freetype=true"
# Enable ozone wayland and/or headless support
myconf_gn+=" use_ozone=true ozone_auto_platforms=false"
myconf_gn+=" ozone_platform_headless=true"
@ -1273,6 +1121,7 @@ src_configure() {
}
chromium_compile() {
# Final link uses lots of file descriptors.
ulimit -n 2048
@ -1302,21 +1151,6 @@ chromium_compile() {
pax-mark m out/Release/chrome
if ! use system-toolchain; then
QA_FLAGS_IGNORED="
usr/lib64/chromium-browser/chrome
usr/lib64/chromium-browser/chrome-sandbox
usr/lib64/chromium-browser/chromedriver
usr/lib64/chromium-browser/chrome_crashpad_handler
usr/lib64/chromium-browser/libEGL.so
usr/lib64/chromium-browser/libGLESv2.so
usr/lib64/chromium-browser/libVkICD_mock_icd.so
usr/lib64/chromium-browser/libVkLayer_khronos_validation.so
usr/lib64/chromium-browser/libqt5_shim.so
usr/lib64/chromium-browser/libvk_swiftshader.so
usr/lib64/chromium-browser/libvulkan.so.1
"
fi
}
# This function is called from virtx, and must always return so that Xvfb
@ -1410,6 +1244,34 @@ src_test() {
StringPieceTest.OutOfBoundsDeath
ThreadPoolEnvironmentConfig.CanUseBackgroundPriorityForWorker
ValuesUtilTest.FilePath
# Gentoo-specific
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/3
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/3
CharacterEncodingTest.GetCanonicalEncodingNameByAliasName
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGFPE
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGILL
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGV
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGVNonCanonicalAddress
FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe
FileTest.GetInfoForCreationTime
ICUStringConversionsTest.ConvertToUtf8AndNormalize
NumberFormattingTest.FormatPercent
PathServiceTest.CheckedGetFailure
PlatformThreadTest.CanChangeThreadType
StackCanary.ChangingStackCanaryCrashesOnReturn
StackTraceDeathTest.StackDumpSignalHandlerIsMallocFree
SysStrings.SysNativeMBAndWide
SysStrings.SysNativeMBToWide
SysStrings.SysWideToNativeMB
TestLauncherTools.TruncateSnippetFocusedMatchesFatalMessagesTest
ToolsSanityTest.BadVirtualCallNull
ToolsSanityTest.BadVirtualCallWrongType
)
local test_filter="-$(IFS=:; printf '%s' "${skip_tests[*]}")"
# test-launcher-bot-mode enables parallelism and plain output

View file

@ -1,36 +1,16 @@
# Copyright 2009-2024 Gentoo Authors
# Copyright 2009-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# PACKAGING NOTES
# Google roll their bundled Clang every two weeks, and the bundled Rust
# is rolled regularly and depends on that. While we do our best to build
# with system Clang, we will eventually hit the point where we need to use
# the bundled Clang due to the use of prerelease features. We've been lucky
# enough so far that this hasn't been an issue.
# We use llvm-utils.eclass directly due to chromium's inherent Googliness.
# GN is bundled with Chromium, but we always use the system version. Remember to
# check for upstream changes to GN and update ebuild (and version below) as required.
# For binhost users, if USE=bindist is set, we configure Chromium in a way that it is able
# to use proprietary codecs, and so that ffmpeg is an external component (libffmpeg.so),
# then we remove ffmpeg from the image to ensure that the built package is distributable
# (i.e. we don't owe royalties). A suitable libffmpeg.so is symlinked in its place;
# as a result of this, ffmpeg[chromium] or ffmpeg-chromium must be installed on the system.
# For non-binhost builds, we build the bundled ffmpeg and enable proprietary codecs because there's
# no reason not to. Todo: Re-enable USE=system-ffmpeg.
# This uses a gentoo-created tarball due to Google CI Failures.
# Use 133(?) as a base for new official tarballs.
GN_MIN_VER=0.2165
RUST_MIN_VER=1.78.0
# chromium-tools/get-chromium-toolchain-strings.sh
GOOGLE_CLANG_VER=llvmorg-19-init-14561-gecea8371-3000
GOOGLE_RUST_VER=3cf924b934322fd7b514600a7dc84fc517515346-3
: ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN=no}
# chromium-tools/get-chromium-toolchain-strings.py
TEST_FONT=f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35
VIRTUALX_REQUIRED="pgo"
@ -38,43 +18,45 @@ CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
sv sw ta te th tr uk ur vi zh-CN zh-TW"
# While prerelease llvm is actually used in the google build, until we have a
# sane way to select 'rust built with this llvm slot' that isn't stable and testing
# subslots we will have to restrict LLVM_COMPAT to stable and testing keywords.
LLVM_COMPAT=( {17..18} )
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{11..13} )
PYTHON_REQ_USE="xml(+)"
RUST_MIN_VER=1.78.0
RUST_NEEDS_LLVM="yes please"
inherit check-reqs chromium-2 desktop flag-o-matic llvm-utils ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 systemd toolchain-funcs virtualx xdg-utils
inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 rust systemd toolchain-funcs virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="https://www.chromium.org/"
PATCHSET_PPC64="128.0.6613.119-1raptor0~deb12u1"
PATCH_V="${PV%%\.*}"
SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
system-toolchain? (
PPC64_HASH="a85b64f07b489b8c6fdb13ecf79c16c56c560fc6"
PATCH_V="${PV%%\.*}-1"
SRC_URI="https://chromium-tarballs.distfiles.gentoo.org/${P}-linux.tar.xz
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2
)
!system-toolchain? (
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-${GOOGLE_CLANG_VER}.tar.xz
-> chromium-${PV%%\.*}-clang.tar.xz
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/rust-toolchain-${GOOGLE_RUST_VER}-${GOOGLE_CLANG_VER%?????}.tar.xz
-> chromium-${PV%%\.*}-rust.tar.xz
test? (
https://chromium-tarballs.distfiles.gentoo.org/${P}-linux-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz
)
ppc64? (
https://quickbuild.io/~raptor-engineering-public/+archive/ubuntu/chromium/+files/chromium_${PATCHSET_PPC64}.debian.tar.xz
https://deps.gentoo.zip/chromium-ppc64le-gentoo-patches-1.tar.xz
https://gitlab.solidsilicon.io/public-development/open-source/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
)
pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
LICENSE="BSD"
SLOT="0/stable"
KEYWORDS="arm64"
# Dev exists mostly to give devs some breathing room for beta/stable releases;
# it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="arm64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo +proprietary-codecs pulseaudio"
IUSE+=" qt5 qt6 +screencast selinux +system-toolchain +vaapi +wayland +widevine"
RESTRICT="!bindist? ( bindist )"
IUSE+=" qt5 qt6 +screencast selinux test +vaapi +wayland +widevine"
RESTRICT="
!bindist? ( bindist )
!test? ( test )
"
REQUIRED_USE="
!headless? ( || ( X wayland ) )
@ -182,29 +164,6 @@ DEPEND="${COMMON_DEPEND}
)
"
depend_clang_llvm_version() {
echo "sys-devel/clang:$1"
echo "sys-devel/llvm:$1"
echo "=sys-devel/lld-$1*"
echo "virtual/rust:0/llvm-${1}[profiler(-)]"
echo "pgo? ( sys-libs/compiler-rt-sanitizers:${1}[profile] )"
}
# Parse LLVM_COMPAT and generate a usedep for each version
depend_clang_llvm_versions() {
if [[ ${#LLVM_COMPAT[@]} -eq 0 ]]; then
depend_clang_llvm_version ${#LLVM_COMPAT[0]}
else
echo "|| ("
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
echo "("
depend_clang_llvm_version ${LLVM_COMPAT[i]}
echo ")"
done
echo ")"
fi
}
BDEPEND="
${COMMON_SNAPSHOT_DEPEND}
${PYTHON_DEPS}
@ -216,14 +175,16 @@ BDEPEND="
qt5? ( dev-qt/qtcore:5 )
qt6? ( dev-qt/qtbase:6 )
)
system-toolchain? (
$(depend_clang_llvm_versions)
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
llvm-core/llvm:${LLVM_SLOT}
llvm-core/lld:${LLVM_SLOT}
')
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
>=dev-build/gn-${GN_MIN_VER}
dev-build/ninja
dev-lang/perl
@ -313,110 +274,62 @@ pkg_pretend() {
fi
}
# Chromium should build with any version of clang that we support
# but we may need to pick the "best" one for a build (highest installed,
# rust is built against it, etc.)
# Check each slot in LLVM_COMPAT to see if clang/llvm/lld are available
# and output the _highest_ slot that is actually available on a system.
chromium_pick_llvm_slot() {
# LLVM_COMPAT is always going to be oldest to newest (or one value)
# let's flip it and check from newest to oldest and return the first one we find.
local slot
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
slot=${LLVM_COMPAT[i]}
if has_version "sys-devel/clang:${slot}" && \
has_version "sys-devel/llvm:${slot}" && \
has_version "sys-devel/lld:${slot}" && \
has_version "virtual/rust:0/llvm-${slot}" && \
( ! use pgo || has_version "sys-libs/compiler-rt-sanitizers:${slot}" ) ; then
echo "${slot}"
return
fi
done
die_msg="
No suitable clang/llvm/lld slot found.
Slots checked: ${LLVM_COMPAT[*]}.
"
die "${die_msg}"
}
# We need the rust version in src_configure and pkg_setup
chromium_extract_rust_version() {
[[ ${MERGE_TYPE} == binary ]] && return
local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
rustc_version=${rustc_version[0]#rust-bin-}
rustc_version=${rustc_version#rust-}
[[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
echo $rustc_version
}
pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]]; then
# The pre_build_checks are all about compilation resources, no need to run it for a binpkg
pre_build_checks
if use system-toolchain; then
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
if ! tc-is-lto && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
LLVM_SLOT=$(chromium_pick_llvm_slot)
export LLVM_SLOT # used in src_configure for rust-y business
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
fi
# The llvm-r1_pkg_setup we have at home.
# We prepend the path _first_ to explicitly use the selected slot.
llvm_prepend_path "${LLVM_SLOT}"
llvm_fix_clang_version CC CPP CXX
llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB
llvm_fix_tool_path READELF STRINGS STRIP
# Set LLVM_CONFIG to help Meson (bug #907965) but only do it
# for empty ESYSROOT (as a proxy for "are we cross-compiling?").
if [[ -z ${ESYSROOT} ]] ; then
llvm_fix_tool_path LLVM_CONFIG
fi
einfo "Using LLVM/Clang slot ${LLVM_SLOT} to build"
local rustc_ver=$(chromium_extract_rust_version)
if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
eerror "Rust >=${RUST_MIN_VER} is required"
eerror "Please run 'eselect rust' and select the correct rust version"
die "Selected rust version is too old"
else
einfo "Using rust ${rustc_ver} to build"
fi
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Users should never hit this, it's purely a development convenience
if ver_test $(gn --version || die) -lt ${GN_MIN_VER}; then
die "dev-build/gn >= ${GN_MIN_VER} is required to build this Chromium"
@ -427,26 +340,24 @@ pkg_setup() {
}
src_unpack() {
# In 126 Chromium upstream decided to change the way that the rust toolchain is packaged
# so now we get a fancy src_unpack function to ensure that we don't accidentally unpack
# one toolchain over the other. The addtional control over over unpacking also helps us
# ensure that GN doesn't try and use some bundled tool (like bindgen) instead of the system
# package by just not unpacking it unless we're using the bundled toolchain.
unpack ${P}.tar.xz
if use system-toolchain; then
unpack chromium-patches-${PATCH_V}.tar.bz2
else
unpack chromium-${PV%%\.*}-clang.tar.xz
local rust_dir="${WORKDIR}/rust-toolchain"
mkdir -p ${rust_dir} || die "Failed to create rust toolchain directory"
tar xf "${DISTDIR}/chromium-${PV%%\.*}-rust.tar.xz" -C ${rust_dir} || die "Failed to unpack rust toolchain"
fi
unpack ${P}-linux.tar.xz
unpack chromium-patches-${PATCH_V}.tar.bz2
use pgo && unpack chromium-profiler-0.2.tar
if use test; then
# A new testdata tarball is available for each release; but testfonts tend to remain stable
# for the duration of a release.
# This unpacks directly into/over ${WORKDIR}/${P} so we can just use `unpack`.
unpack ${P}-linux-testdata.tar.xz
# This just contains a bunch of font files that need to be unpacked (or moved) to the correct location.
local testfonts_dir="${WORKDIR}/${P}/third_party/test_fonts"
local testfonts_tar="${DISTDIR}/chromium-testfonts-${TEST_FONT:0:10}.tar.gz"
tar xf "${testfonts_tar}" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
fi
if use ppc64; then
unpack chromium_${PATCHSET_PPC64}.debian.tar.xz
unpack chromium-ppc64le-gentoo-patches-1.tar.xz
unpack chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
fi
}
@ -457,44 +368,29 @@ src_prepare() {
# disable global media controls, crashes with libstdc++
sed -i -e \
"/\"GlobalMediaControlsCastStartStop\"/,+4{s/ENABLED/DISABLED/;}" \
"chrome/browser/media/router/media_router_feature.cc" || die
"chrome/browser/media/router/media_router_feature.cc"
local PATCHES=(
"${FILESDIR}/chromium-cross-compile.patch"
"${FILESDIR}/chromium-109-system-zlib.patch"
"${FILESDIR}/chromium-111-InkDropHost-crash.patch"
"${FILESDIR}/chromium-126-oauth2-client-switches.patch"
"${FILESDIR}/chromium-127-bindgen-custom-toolchain.patch"
"${FILESDIR}/chromium-127-updater-systemd.patch"
"${FILESDIR}/chromium-131-unbundle-icu-target.patch"
"${FILESDIR}/chromium-131-oauth2-client-switches.patch"
"${FILESDIR}/chromium-131-const-atomicstring-conversion.patch"
)
# 127: test deps are broken for ui/lens with system ICU "//third_party/icu:icuuc_public"
sed -i '/source_set("unit_tests") {/,/}/d' \
chrome/browser/ui/lens/BUILD.gn || die "Failed to remove bad test target"
sed -i '/lens:unit_tests/d' chrome/test/BUILD.gn components/BUILD.gn \
|| die "Failed to remove dependencies on bad target"
if use widevine; then
PATCHES+=("${FILESDIR}/chromium-001-widevine-support-for-arm.patch")
PATCHES+=(${FILESDIR}/chromium-001-widevine-support-for-arm.patch)
fi
if use system-toolchain; then
# The patchset is really only required if we're using the system-toolchain
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins
sed -i -e \
"/if (is_clang && toolchain_has_rust) {/,+2d" \
build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
else
mkdir -p third_party/llvm-build/Release+Asserts || die "Failed to bundle llvm"
ln -s "${WORKDIR}"/bin third_party/llvm-build/Release+Asserts/bin || die "Failed to symlink llvm bin"
ln -s "${WORKDIR}"/lib third_party/llvm-build/Release+Asserts/lib || die "Failed to symlink llvm lib"
echo "${GOOGLE_CLANG_VER}" > third_party/llvm-build/Release+Asserts/cr_build_revision || \
die "Failed to set clang version"
ln -s "${WORKDIR}"/rust-toolchain third_party/rust-toolchain || die "Failed to bundle rust"
cp "${WORKDIR}"/rust-toolchain/VERSION \
"${WORKDIR}"/rust-toolchain/INSTALLED_VERSION || die "Failed to set rust version"
fi
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
if use ppc64 ; then
local p
@ -515,6 +411,8 @@ src_prepare() {
# adjust python interpreter version
sed -i -e "s|\(^script_executable = \).*|\1\"${EPYTHON}\"|g" .gn || die
# remove_bundled_libraries.py walks the source tree and looks for paths containing the substring 'third_party'
# whitelist matches use the right-most matching path component, so we need to whitelist from that point down.
local keeplibs=(
base/third_party/cityhash
base/third_party/double_conversion
@ -526,7 +424,6 @@ src_prepare() {
buildtools/third_party/libc++
buildtools/third_party/libc++abi
chrome/third_party/mozilla_security_manager
courgette/third_party
net/third_party/mozilla_security_manager
net/third_party/nss
net/third_party/quic
@ -589,14 +486,15 @@ src_prepare() {
third_party/devtools-frontend/src/front_end/third_party/diff
third_party/devtools-frontend/src/front_end/third_party/i18n
third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
third_party/devtools-frontend/src/front_end/third_party/json5
third_party/devtools-frontend/src/front_end/third_party/lighthouse
third_party/devtools-frontend/src/front_end/third_party/lit
third_party/devtools-frontend/src/front_end/third_party/lodash-isequal
third_party/devtools-frontend/src/front_end/third_party/marked
third_party/devtools-frontend/src/front_end/third_party/puppeteer
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/parsel-js
third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/rxjs
third_party/devtools-frontend/src/front_end/third_party/third-party-web
third_party/devtools-frontend/src/front_end/third_party/vscode.web-custom-data
third_party/devtools-frontend/src/front_end/third_party/wasmparser
third_party/devtools-frontend/src/front_end/third_party/web-vitals
@ -606,6 +504,7 @@ src_prepare() {
third_party/eigen3
third_party/emoji-segmenter
third_party/farmhash
third_party/fast_float
third_party/fdlibm
third_party/ffmpeg
third_party/fft2d
@ -622,6 +521,17 @@ src_prepare() {
third_party/highway
third_party/hunspell
third_party/iccjpeg
third_party/ink_stroke_modeler/src/ink_stroke_modeler
third_party/ink_stroke_modeler/src/ink_stroke_modeler/internal
third_party/ink/src/ink/brush
third_party/ink/src/ink/color
third_party/ink/src/ink/geometry
third_party/ink/src/ink/rendering
third_party/ink/src/ink/rendering/skia/common_internal
third_party/ink/src/ink/rendering/skia/native
third_party/ink/src/ink/rendering/skia/native/internal
third_party/ink/src/ink/strokes
third_party/ink/src/ink/types
third_party/inspector_protocol
third_party/ipcz
third_party/jinja2
@ -645,7 +555,6 @@ src_prepare() {
third_party/libsecret
third_party/libsrtp
third_party/libsync
third_party/libudev
third_party/liburlpattern
third_party/libva_protected_content
third_party/libvpx
@ -699,6 +608,7 @@ src_prepare() {
third_party/pyjson5
third_party/pyyaml
third_party/qcms
third_party/rapidhash
third_party/re2
third_party/rnnoise
third_party/rust
@ -732,8 +642,10 @@ src_prepare() {
third_party/tflite/src/third_party/eigen3
third_party/tflite/src/third_party/fft2d
third_party/tflite/src/third_party/xla/third_party/tsl
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/tflite/src/third_party/xla/xla/tsl/framework
third_party/tflite/src/third_party/xla/xla/tsl/lib/random
third_party/tflite/src/third_party/xla/xla/tsl/protobuf
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/ukey2
third_party/unrar
third_party/utf
@ -771,6 +683,17 @@ src_prepare() {
third_party/xdg-utils
)
if use test; then
# tar tvf /var/cache/distfiles/${P}-testdata.tar.xz | grep '^d' | grep 'third_party' | awk '{print $NF}'
keeplibs+=(
third_party/google_benchmark/src/include/benchmark
third_party/google_benchmark/src/src
third_party/perfetto/protos/third_party/pprof
third_party/test_fonts
third_party/test_fonts/fontconfig
)
fi
# USE=system-*
if ! use system-harfbuzz; then
keeplibs+=( third_party/harfbuzz-ng )
@ -788,10 +711,6 @@ src_prepare() {
keeplibs+=( third_party/zstd )
fi
if ! use system-toolchain || [[ ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN} == yes ]]; then
keeplibs+=( third_party/llvm )
fi
# Arch-specific
if use arm64 || use ppc64 ; then
keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
@ -816,10 +735,38 @@ src_prepare() {
popd >/dev/null || die
fi
einfo "Unbundling third-party libraries ..."
# Sanity check keeplibs, on major version bumps it is often necessary to update this list
# and this enables us to hit them all at once.
# There are some entries that need to be whitelisted (TODO: Why? The file is understandable, the rest seem odd)
whitelist_libs=(
net/third_party/quic
third_party/devtools-frontend/src/front_end/third_party/additional_readme_paths.json
third_party/libjingle
third_party/mesa
third_party/skia/third_party/vulkan
third_party/vulkan
)
local not_found_libs=()
for lib in "${keeplibs[@]}"; do
if [[ ! -d "${lib}" ]] && ! has "${lib}" "${whitelist_libs[@]}"; then
not_found_libs+=( "${lib}" )
fi
done
if [[ ${#not_found_libs[@]} -gt 0 ]]; then
eerror "The following \`keeplibs\` directories were not found in the source tree:"
for lib in "${not_found_libs[@]}"; do
eerror " ${lib}"
done
die "Please update the ebuild."
fi
# Remove most bundled libraries. Some are still needed.
einfo "Unbundling third-party libraries ..."
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
# TODO: From 127 chromium includes a bunch of binaries? Unbundle them; they're not needed.
# bundled eu-strip is for amd64 only and we don't want to pre-stripped binaries
mkdir -p buildtools/third_party/eu-strip/bin || die
ln -s "${EPREFIX}"/bin/true buildtools/third_party/eu-strip/bin/eu-strip || die
@ -832,73 +779,63 @@ chromium_configure() {
local myconf_gn=""
# We already forced the "correct" clang via pkg_setup
if use system-toolchain; then
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
# from get_llvm_prefix
local prefix=${ESYSROOT}
[[ ${1} == -b ]] && prefix=${BROOT}
myconf_gn+=" bindgen_libclang_path=\"${prefix}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
# We need to provide this to GN in both the path to rust _and_ the version
local rustc_ver=$(chromium_extract_rust_version)
if [[ "$(eselect --brief rust show 2>/dev/null)" == *"bin"* ]]; then
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/opt/rust-bin-${rustc_ver}/\""
else
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/usr/lib/rust/${rustc_ver}/\""
fi
myconf_gn+=" rustc_version=\"${rustc_ver}\""
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
myconf_gn+=" bindgen_libclang_path=\"$(get_llvm_prefix)/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
myconf_gn+=" rust_sysroot_absolute=\"$(get_rust_prefix)\""
myconf_gn+=" rustc_version=\"${RUST_SLOT}\""
# GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
myconf_gn+=" is_debug=false"
@ -947,6 +884,13 @@ chromium_configure() {
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
# TODO 131: The above call clobbers `enable_freetype = true` in the freetype gni file
# drop the last line, then append the freetype line and a new curly brace to end the block
local freetype_gni="build/config/freetype/freetype.gni"
sed -i -e '$d' ${freetype_gni} || die
echo " enable_freetype = true" >> ${freetype_gni} || die
echo "}" >> ${freetype_gni} || die
# See dependency logic in third_party/BUILD.gn
myconf_gn+=" use_system_harfbuzz=$(usex system-harfbuzz true false)"
@ -1087,6 +1031,11 @@ chromium_configure() {
# Don't need nocompile checks and GN crashes with our config
myconf_gn+=" enable_nocompile_tests=false"
# 131 began laying the groundwork for replacing freetype with
# "Rust-based Fontations set of libraries plus Skia path rendering"
# We now need to opt-in
myconf_gn+=" enable_freetype=true"
# Enable ozone wayland and/or headless support
myconf_gn+=" use_ozone=true ozone_auto_platforms=false"
myconf_gn+=" ozone_platform_headless=true"
@ -1132,20 +1081,6 @@ chromium_configure() {
use wayland && myconf_gn+=" use_system_libffi=true"
fi
# Results in undefined references in chrome linking, may require CFI to work
if use arm64; then
myconf_gn+=" arm_control_flow_integrity=\"none\""
fi
# 936673: Updater (which we don't use) depends on libsystemd
# This _should_ always be disabled if we're not building a
# "Chrome" branded browser, but obviously this is not always sufficient.
myconf_gn+=" enable_updater=false"
local use_lto="false"
if tc-is-lto; then
use_lto="true"
fi
myconf_gn+=" use_thin_lto=${use_lto}"
myconf_gn+=" thin_lto_enable_optimizations=${use_lto}"
@ -1155,8 +1090,7 @@ chromium_configure() {
# Allow building against system libraries in official builds
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
tools/generate_shim_headers/generate_shim_headers.py || die
# Req's LTO; TODO: not compatible with -fno-split-lto-unit
myconf_gn+=" is_cfi=false"
myconf_gn+=" is_cfi=${use_lto}"
# Don't add symbols to build
myconf_gn+=" symbol_level=0"
fi
@ -1187,6 +1121,7 @@ src_configure() {
}
chromium_compile() {
# Final link uses lots of file descriptors.
ulimit -n 2048
@ -1212,25 +1147,10 @@ chromium_compile() {
# Even though ninja autodetects number of CPUs, we respect
# user's options, for debugging with -j 1 or any other reason.
eninja -C out/Release chrome chromedriver chrome_sandbox
eninja -C out/Release chrome chromedriver chrome_sandbox $(use test && echo "base_unittests")
pax-mark m out/Release/chrome
if ! use system-toolchain; then
QA_FLAGS_IGNORED="
usr/lib64/chromium-browser/chrome
usr/lib64/chromium-browser/chrome-sandbox
usr/lib64/chromium-browser/chromedriver
usr/lib64/chromium-browser/chrome_crashpad_handler
usr/lib64/chromium-browser/libEGL.so
usr/lib64/chromium-browser/libGLESv2.so
usr/lib64/chromium-browser/libVkICD_mock_icd.so
usr/lib64/chromium-browser/libVkLayer_khronos_validation.so
usr/lib64/chromium-browser/libqt5_shim.so
usr/lib64/chromium-browser/libvk_swiftshader.so
usr/lib64/chromium-browser/libvulkan.so.1
"
fi
}
# This function is called from virtx, and must always return so that Xvfb
@ -1309,6 +1229,57 @@ src_compile() {
out/Release/vk_swiftshader_icd.json || die
}
src_test() {
# Initial list of tests to skip pulled from Alpine. Thanks Lauren!
# https://issues.chromium.org/issues/40939315
local skip_tests=(
'MessagePumpLibeventTest.NestedNotification*'
ClampTest.Death
OptionalTest.DereferencingNoValueCrashes
PlatformThreadTest.SetCurrentThreadTypeTest
RawPtrTest.TrivialRelocability
SafeNumerics.IntMaxOperations
StackTraceTest.TraceStackFramePointersFromBuffer
StringPieceTest.InvalidLengthDeath
StringPieceTest.OutOfBoundsDeath
ThreadPoolEnvironmentConfig.CanUseBackgroundPriorityForWorker
ValuesUtilTest.FilePath
# Gentoo-specific
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/3
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/3
CharacterEncodingTest.GetCanonicalEncodingNameByAliasName
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGFPE
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGILL
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGV
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGVNonCanonicalAddress
FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe
FileTest.GetInfoForCreationTime
ICUStringConversionsTest.ConvertToUtf8AndNormalize
NumberFormattingTest.FormatPercent
PathServiceTest.CheckedGetFailure
PlatformThreadTest.CanChangeThreadType
StackCanary.ChangingStackCanaryCrashesOnReturn
StackTraceDeathTest.StackDumpSignalHandlerIsMallocFree
SysStrings.SysNativeMBAndWide
SysStrings.SysNativeMBToWide
SysStrings.SysWideToNativeMB
TestLauncherTools.TruncateSnippetFocusedMatchesFatalMessagesTest
ToolsSanityTest.BadVirtualCallNull
ToolsSanityTest.BadVirtualCallWrongType
)
local test_filter="-$(IFS=:; printf '%s' "${skip_tests[*]}")"
# test-launcher-bot-mode enables parallelism and plain output
./out/Release/base_unittests --test-launcher-bot-mode \
--test-launcher-jobs="$(makeopts_jobs)" \
--gtest_filter="${test_filter}" || die "Tests failed!"
}
src_install() {
local CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
exeinto "${CHROMIUM_HOME}"

View file

@ -5,33 +5,12 @@ EAPI=8
# PACKAGING NOTES
# Google roll their bundled Clang every two weeks, and the bundled Rust
# is rolled regularly and depends on that. While we do our best to build
# with system Clang, we will eventually hit the point where we need to use
# the bundled Clang due to the use of prerelease features. We've been lucky
# enough so far that this hasn't been an issue.
# We use llvm-utils.eclass directly due to chromium's inherent Googliness.
# This uses a gentoo-created tarball due to Google CI Failures.
# Use 133(?) as a base for new official tarballs.
# GN is bundled with Chromium, but we always use the system version. Remember to
# check for upstream changes to GN and update ebuild (and version below) as required.
# For binhost users, if USE=bindist is set, we configure Chromium in a way that it is able
# to use proprietary codecs, and so that ffmpeg is an external component (libffmpeg.so),
# then we remove ffmpeg from the image to ensure that the built package is distributable
# (i.e. we don't owe royalties). A suitable libffmpeg.so is symlinked in its place;
# as a result of this, ffmpeg[chromium] or ffmpeg-chromium must be installed on the system.
# For non-binhost builds, we build the bundled ffmpeg and enable proprietary codecs because there's
# no reason not to. Todo: Re-enable USE=system-ffmpeg.
GN_MIN_VER=0.2200
RUST_MIN_VER=1.78.0
# chromium-tools/get-chromium-toolchain-strings.sh
GOOGLE_CLANG_VER=llvmorg-20-init-3847-g69c43468-28
# Upstream this is -3 but google haven't published the chromium-dev rust toolchain.
GOOGLE_RUST_VER=009e73825af0e59ad4fc603562e038b3dbd6593a-2
: ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN=no}
GN_MIN_VER=0.2165
# chromium-tools/get-chromium-toolchain-strings.py
TEST_FONT=f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35
VIRTUALX_REQUIRED="pgo"
@ -39,49 +18,45 @@ CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
sv sw ta te th tr uk ur vi zh-CN zh-TW"
# While prerelease llvm is actually used in the google build, until we have a
# sane way to select 'rust built with this llvm slot' that isn't stable and testing
# subslots we will have to restrict LLVM_COMPAT to stable and testing keywords.
LLVM_COMPAT=( 17 18 )
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{11..13} )
PYTHON_REQ_USE="xml(+)"
RUST_MIN_VER=1.78.0
RUST_NEEDS_LLVM="yes please"
inherit check-reqs chromium-2 desktop flag-o-matic llvm-utils ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 systemd toolchain-funcs virtualx xdg-utils
inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils
inherit python-any-r1 qmake-utils readme.gentoo-r1 rust systemd toolchain-funcs virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="https://www.chromium.org/"
PATCHSET_PPC64="128.0.6613.84-1raptor0~deb12u1"
PATCH_V="${PV%%\.*}-1"
SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
system-toolchain? (
PPC64_HASH="a85b64f07b489b8c6fdb13ecf79c16c56c560fc6"
PATCH_V="${PV%%\.*}"
SRC_URI="https://chromium-tarballs.distfiles.gentoo.org/${P}-linux.tar.xz
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2
)
!system-toolchain? (
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-${GOOGLE_CLANG_VER}.tar.xz
-> chromium-${PV%%\.*}-clang.tar.xz
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/rust-toolchain-${GOOGLE_RUST_VER}-${GOOGLE_CLANG_VER%???}.tar.xz
-> chromium-${PV%%\.*}-rust.tar.xz
test? (
https://chromium-tarballs.distfiles.gentoo.org/${P}-linux-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz
)
ppc64? (
https://quickbuild.io/~raptor-engineering-public/+archive/ubuntu/chromium/+files/chromium_${PATCHSET_PPC64}.debian.tar.xz
https://deps.gentoo.zip/chromium-ppc64le-gentoo-patches-1.tar.xz
https://gitlab.solidsilicon.io/public-development/open-source/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
)
pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
LICENSE="BSD"
SLOT="0/dev"
# Dev exists mostly to give devs some breathing room for beta/stable releases; it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} == "0/dev" ]]; then
KEYWORDS="~arm64"
else
SLOT="0/beta"
# Dev exists mostly to give devs some breathing room for beta/stable releases;
# it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="~arm64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo +proprietary-codecs pulseaudio"
IUSE+=" qt5 qt6 +screencast selinux +system-toolchain +vaapi +wayland +widevine"
RESTRICT="!bindist? ( bindist )"
IUSE+=" qt5 qt6 +screencast selinux test +vaapi +wayland +widevine"
RESTRICT="
!bindist? ( bindist )
!test? ( test )
"
REQUIRED_USE="
!headless? ( || ( X wayland ) )
@ -119,7 +94,6 @@ COMMON_SNAPSHOT_DEPEND="
media-libs/mesa:=[gbm(+)]
>=media-libs/openh264-1.6.0:=
sys-libs/zlib:=
x11-libs/libdrm:=
!headless? (
dev-libs/glib:2
>=media-libs/alsa-lib-1.0.19:=
@ -189,29 +163,6 @@ DEPEND="${COMMON_DEPEND}
)
"
depend_clang_llvm_version() {
echo "sys-devel/clang:$1"
echo "sys-devel/llvm:$1"
echo "=sys-devel/lld-$1*"
echo "virtual/rust:0/llvm-${1}[profiler(-)]"
echo "pgo? ( sys-libs/compiler-rt-sanitizers:${1}[profile] )"
}
# Parse LLVM_COMPAT and generate a usedep for each version
depend_clang_llvm_versions() {
if [[ ${#LLVM_COMPAT[@]} -eq 0 ]]; then
depend_clang_llvm_version ${#LLVM_COMPAT[0]}
else
echo "|| ("
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
echo "("
depend_clang_llvm_version ${LLVM_COMPAT[i]}
echo ")"
done
echo ")"
fi
}
BDEPEND="
${COMMON_SNAPSHOT_DEPEND}
${PYTHON_DEPS}
@ -223,14 +174,16 @@ BDEPEND="
qt5? ( dev-qt/qtcore:5 )
qt6? ( dev-qt/qtbase:6 )
)
system-toolchain? (
$(depend_clang_llvm_versions)
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
llvm-core/llvm:${LLVM_SLOT}
llvm-core/lld:${LLVM_SLOT}
')
pgo? (
>=dev-python/selenium-3.141.0
>=dev-util/web_page_replay_go-20220314
)
>=dev-util/bindgen-0.68.0
>=dev-build/gn-${GN_MIN_VER}
dev-build/ninja
dev-lang/perl
@ -320,140 +273,62 @@ pkg_pretend() {
fi
}
# Chromium should build with any version of clang that we support
# but we may need to pick the "best" one for a build (highest installed,
# rust is built against it, etc.)
# Check each slot in LLVM_COMPAT to see if clang/llvm/lld are available
# and output the _highest_ slot that is actually available on a system.
chromium_pick_llvm_slot() {
# LLVM_COMPAT is always going to be oldest to newest (or one value)
# let's flip it and check from newest to oldest and return the first one we find.
local slot
for (( i=${#LLVM_COMPAT[@]}-1 ; i>=0 ; i-- )); do
slot=${LLVM_COMPAT[i]}
if has_version "sys-devel/clang:${slot}" && \
has_version "sys-devel/llvm:${slot}" && \
has_version "sys-devel/lld:${slot}" && \
has_version "virtual/rust:0/llvm-${slot}" && \
( ! use pgo || has_version "sys-libs/compiler-rt-sanitizers:${slot}" ) ; then
echo "${slot}"
return
fi
done
die_msg="
No suitable clang/llvm/lld slot found.
Slots checked: ${LLVM_COMPAT[*]}.
"
die "${die_msg}"
}
# We need the rust version in src_configure and pkg_setup
chromium_extract_rust_version() {
[[ ${MERGE_TYPE} == binary ]] && return
local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
rustc_version=${rustc_version[0]#rust-bin-}
rustc_version=${rustc_version#rust-}
[[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
echo $rustc_version
}
pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]]; then
# The pre_build_checks are all about compilation resources, no need to run it for a binpkg
pre_build_checks
if use system-toolchain; then
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
if ! tc-is-lto && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance and security reasons,"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
# TODO: compare build time, memory and disk usage on several builds.
filter-lto
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
LLVM_SLOT=$(chromium_pick_llvm_slot)
export LLVM_SLOT # used in src_configure for rust-y business
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
fi
# The llvm-r1_pkg_setup we have at home.
# We prepend the path _first_ to explicitly use the selected slot.
llvm_prepend_path "${LLVM_SLOT}"
llvm_fix_clang_version CC CPP CXX
llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB
llvm_fix_tool_path READELF STRINGS STRIP
# Set LLVM_CONFIG to help Meson (bug #907965) but only do it
# for empty ESYSROOT (as a proxy for "are we cross-compiling?").
if [[ -z ${ESYSROOT} ]] ; then
llvm_fix_tool_path LLVM_CONFIG
fi
einfo "Using LLVM/Clang slot ${LLVM_SLOT} to build"
local rustc_ver=$(chromium_extract_rust_version)
if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
eerror "Rust >=${RUST_MIN_VER} is required to build Chromium"
eerror "The currently selected version is ${rustc_ver}"
eerror "Please run \`eselect rust\` and select an appropriate Rust."
die "Selected Rust version is too old"
else
einfo "Using Rust ${rustc_ver} to build"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Chromium requires the Rust profiler library while setting up its build environment.
# Since a standard Rust comes with the profiler, instead of patching it out (build/rust/std/BUILD.gn#L103)
# we'll just do a sanity check on the selected slot.
# The -bin always contains profiler support, so we only need to check for the non-bin version.
if [[ "$(eselect --brief rust show 2>/dev/null)" != *"bin"* ]]; then
local rust_lib_path="${EPREFIX}$(rustc --print target-libdir)"
local profiler_lib=$(find "${rust_lib_path}" -name "libprofiler_builtins-*.rlib" -print -quit)
if [[ -z "${profiler_lib}" ]]; then
eerror "Rust ${rustc_ver} is missing the profiler library."
eerror "ebuild dependency resolution should have ensured that a Rust with the profiler was installed."
die "Please \`eselect\` a Rust slot that has the profiler."
fi
fi
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi
export use_lto
# 936858
if tc-ld-is-mold; then
eerror "Your toolchain is using the mold linker."
eerror "This is not supported by Chromium."
die "Please switch to a different linker."
fi
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1
# Users should never hit this, it's purely a development convenience
if ver_test $(gn --version || die) -lt ${GN_MIN_VER}; then
die "dev-build/gn >= ${GN_MIN_VER} is required to build this Chromium"
@ -464,26 +339,24 @@ pkg_setup() {
}
src_unpack() {
# In 126 Chromium upstream decided to change the way that the rust toolchain is packaged
# so now we get a fancy src_unpack function to ensure that we don't accidentally unpack
# one toolchain over the other. The addtional control over over unpacking also helps us
# ensure that GN doesn't try and use some bundled tool (like bindgen) instead of the system
# package by just not unpacking it unless we're using the bundled toolchain.
unpack ${P}.tar.xz
if use system-toolchain; then
unpack chromium-patches-${PATCH_V}.tar.bz2
else
unpack chromium-${PV%%\.*}-clang.tar.xz
local rust_dir="${WORKDIR}/rust-toolchain"
mkdir -p ${rust_dir} || die "Failed to create rust toolchain directory"
tar xf "${DISTDIR}/chromium-${PV%%\.*}-rust.tar.xz" -C ${rust_dir} || die "Failed to unpack rust toolchain"
fi
unpack ${P}-linux.tar.xz
unpack chromium-patches-${PATCH_V}.tar.bz2
use pgo && unpack chromium-profiler-0.2.tar
if use test; then
# A new testdata tarball is available for each release; but testfonts tend to remain stable
# for the duration of a release.
# This unpacks directly into/over ${WORKDIR}/${P} so we can just use `unpack`.
unpack ${P}-linux-testdata.tar.xz
# This just contains a bunch of font files that need to be unpacked (or moved) to the correct location.
local testfonts_dir="${WORKDIR}/${P}/third_party/test_fonts"
local testfonts_tar="${DISTDIR}/chromium-testfonts-${TEST_FONT:0:10}.tar.gz"
tar xf "${testfonts_tar}" -C "${testfonts_dir}" || die "Failed to unpack testfonts"
fi
if use ppc64; then
unpack chromium_${PATCHSET_PPC64}.debian.tar.xz
unpack chromium-ppc64le-gentoo-patches-1.tar.xz
unpack chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
fi
}
@ -500,35 +373,22 @@ src_prepare() {
"${FILESDIR}/chromium-cross-compile.patch"
"${FILESDIR}/chromium-109-system-zlib.patch"
"${FILESDIR}/chromium-111-InkDropHost-crash.patch"
"${FILESDIR}/chromium-127-bindgen-custom-toolchain.patch"
"${FILESDIR}/chromium-131-unbundle-icu-target.patch"
"${FILESDIR}/chromium-131-oauth2-client-switches.patch"
"${FILESDIR}/chromium-131-const-atomicstring-conversion.patch"
"${FILESDIR}/chromium-132-bindgen-custom-toolchain.patch"
)
if use widevine; then
PATCHES+=("${FILESDIR}/chromium-001-widevine-support-for-arm.patch")
PATCHES+=(${FILESDIR}/chromium-001-widevine-support-for-arm.patch)
fi
if use system-toolchain; then
# The patchset is really only required if we're using the system-toolchain
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
else
mkdir -p third_party/llvm-build/Release+Asserts || die "Failed to bundle llvm"
ln -s "${WORKDIR}"/bin third_party/llvm-build/Release+Asserts/bin || die "Failed to symlink llvm bin"
ln -s "${WORKDIR}"/lib third_party/llvm-build/Release+Asserts/lib || die "Failed to symlink llvm lib"
echo "${GOOGLE_CLANG_VER}" > third_party/llvm-build/Release+Asserts/cr_build_revision || \
die "Failed to set clang version"
ln -s "${WORKDIR}"/rust-toolchain third_party/rust-toolchain || die "Failed to bundle rust"
cp "${WORKDIR}"/rust-toolchain/VERSION \
"${WORKDIR}"/rust-toolchain/INSTALLED_VERSION || die "Failed to set rust version"
fi
PATCHES+=( "${WORKDIR}/chromium-patches-${PATCH_V}" )
# We can't use the bundled compiler builtins with the system toolchain
# `grep` is a development convenience to ensure we fail early when google changes something.
local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {"
grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins"
sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn
if use ppc64 ; then
local p
@ -541,6 +401,13 @@ src_prepare() {
PATCHES+=( "${WORKDIR}/debian/patches/fixes/rust-clanglib.patch" )
fi
# This is a nightly option that does not exist any current release
# https://github.com/rust-lang/rust/commit/389a399a501a626ebf891ae0bb076c25e325ae64
if ver_test ${RUST_SLOT} -le "1.82.0"; then
sed '/rustflags = \[ "-Zdefault-visibility=hidden" \]/d' -i build/config/gcc/BUILD.gn ||
die "Failed to remove default visibility nightly option"
fi
default
rm third_party/node/linux/node-linux-x64/bin/node || die
@ -549,6 +416,8 @@ src_prepare() {
# adjust python interpreter version
sed -i -e "s|\(^script_executable = \).*|\1\"${EPYTHON}\"|g" .gn || die
# remove_bundled_libraries.py walks the source tree and looks for paths containing the substring 'third_party'
# whitelist matches use the right-most matching path component, so we need to whitelist from that point down.
local keeplibs=(
base/third_party/cityhash
base/third_party/double_conversion
@ -622,6 +491,7 @@ src_prepare() {
third_party/devtools-frontend/src/front_end/third_party/diff
third_party/devtools-frontend/src/front_end/third_party/i18n
third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
third_party/devtools-frontend/src/front_end/third_party/json5
third_party/devtools-frontend/src/front_end/third_party/lighthouse
third_party/devtools-frontend/src/front_end/third_party/lit
third_party/devtools-frontend/src/front_end/third_party/marked
@ -661,6 +531,7 @@ src_prepare() {
third_party/ink/src/ink/brush
third_party/ink/src/ink/color
third_party/ink/src/ink/geometry
third_party/ink/src/ink/rendering
third_party/ink/src/ink/rendering/skia/common_internal
third_party/ink/src/ink/rendering/skia/native
third_party/ink/src/ink/rendering/skia/native/internal
@ -682,6 +553,7 @@ src_prepare() {
third_party/libaom/source/libaom/third_party/x86inc
third_party/libavif
third_party/libc++
third_party/libdrm
third_party/libevent
third_party/libgav1
third_party/libjingle
@ -689,6 +561,9 @@ src_prepare() {
third_party/libsecret
third_party/libsrtp
third_party/libsync
third_party/libtess2/libtess2
third_party/libtess2/src/Include
third_party/libtess2/src/Source
third_party/liburlpattern
third_party/libva_protected_content
third_party/libvpx
@ -700,6 +575,8 @@ src_prepare() {
third_party/libyuv
third_party/libzip
third_party/lit
third_party/llvm-libc
third_party/llvm-libc/src/shared/
third_party/lottie
third_party/lss
third_party/lzma_sdk
@ -777,6 +654,8 @@ src_prepare() {
third_party/tflite/src/third_party/fft2d
third_party/tflite/src/third_party/xla/third_party/tsl
third_party/tflite/src/third_party/xla/xla/tsl/framework
third_party/tflite/src/third_party/xla/xla/tsl/lib/random
third_party/tflite/src/third_party/xla/xla/tsl/protobuf
third_party/tflite/src/third_party/xla/xla/tsl/util
third_party/ukey2
third_party/unrar
@ -815,6 +694,18 @@ src_prepare() {
third_party/xdg-utils
)
if use test; then
# tar tvf /var/cache/distfiles/${P}-testdata.tar.xz | grep '^d' | grep 'third_party' | awk '{print $NF}'
keeplibs+=(
third_party/breakpad/breakpad/src/processor
third_party/google_benchmark/src/include/benchmark
third_party/google_benchmark/src/src
third_party/perfetto/protos/third_party/pprof
third_party/test_fonts
third_party/test_fonts/fontconfig
)
fi
# USE=system-*
if ! use system-harfbuzz; then
keeplibs+=( third_party/harfbuzz-ng )
@ -832,10 +723,6 @@ src_prepare() {
keeplibs+=( third_party/zstd )
fi
if ! use system-toolchain || [[ ${CHROMIUM_FORCE_GOOGLE_TOOLCHAIN} == yes ]]; then
keeplibs+=( third_party/llvm )
fi
# Arch-specific
if use arm64 || use ppc64 ; then
keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
@ -890,6 +777,8 @@ src_prepare() {
einfo "Unbundling third-party libraries ..."
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
# TODO: From 127 chromium includes a bunch of binaries? Unbundle them; they're not needed.
# bundled eu-strip is for amd64 only and we don't want to pre-stripped binaries
mkdir -p buildtools/third_party/eu-strip/bin || die
ln -s "${EPREFIX}"/bin/true buildtools/third_party/eu-strip/bin/eu-strip || die
@ -902,73 +791,63 @@ chromium_configure() {
local myconf_gn=""
# We already forced the "correct" clang via pkg_setup
if use system-toolchain; then
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
# from get_llvm_prefix
local prefix=${ESYSROOT}
[[ ${1} == -b ]] && prefix=${BROOT}
myconf_gn+=" bindgen_libclang_path=\"${prefix}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
# We need to provide this to GN in both the path to rust _and_ the version
local rustc_ver=$(chromium_extract_rust_version)
if [[ "$(eselect --brief rust show 2>/dev/null)" == *"bin"* ]]; then
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/opt/rust-bin-${rustc_ver}/\""
else
myconf_gn+=" rust_sysroot_absolute=\"${EPREFIX}/usr/lib/rust/${rustc_ver}/\""
fi
myconf_gn+=" rustc_version=\"${rustc_ver}\""
if tc-is-cross-compiler; then
CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}"
CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}"
BUILD_AR=${AR}
BUILD_CC=${CC}
BUILD_CXX=${CXX}
BUILD_NM=${NM}
fi
strip-unsupported-flags
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
# https://bugs.gentoo.org/918897#c32
append-ldflags -Wl,--undefined-version
myconf_gn+=" use_lld=true"
# Make sure the build system will use the right tools, bug #340795.
tc-export AR CC CXX NM
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
if tc-is-cross-compiler; then
tc-export BUILD_{AR,CC,CXX,NM}
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
# setup cups-config, build system only uses --libs option
if use cups; then
mkdir "${T}/cups-config" || die
cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
export PATH="${PATH}:${T}/cups-config"
fi
# Don't inherit PKG_CONFIG_PATH from environment
local -x PKG_CONFIG_PATH=
else
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
fi
# bindgen settings
# From 127, to make bindgen work, we need to provide a location for libclang.
# We patch this in for gentoo - see chromium-*-bindgen-custom-toolchain.patch
# rust_bindgen_root = directory with `bin/bindgen` beneath it.
myconf_gn+=" rust_bindgen_root=\"${EPREFIX}/usr/\""
myconf_gn+=" bindgen_libclang_path=\"$(get_llvm_prefix)/$(get_libdir)\""
# We don't need to set 'clang_base_bath' for anything in our build
# and it defaults to the google toolchain location. Instead provide a location
# to where system clang lives sot that bindgen can find system headers (e.g. stddef.h)
myconf_gn+=" clang_base_path=\"${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/\""
myconf_gn+=" rust_sysroot_absolute=\"$(get_rust_prefix)\""
myconf_gn+=" rustc_version=\"${RUST_SLOT}\""
# GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
myconf_gn+=" is_debug=false"
@ -997,7 +876,6 @@ chromium_configure() {
freetype
# Need harfbuzz_from_pkgconfig target
#harfbuzz-ng
libdrm
libjpeg
libwebp
libxml
@ -1017,6 +895,13 @@ chromium_configure() {
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
# TODO 131: The above call clobbers `enable_freetype = true` in the freetype gni file
# drop the last line, then append the freetype line and a new curly brace to end the block
local freetype_gni="build/config/freetype/freetype.gni"
sed -i -e '$d' ${freetype_gni} || die
echo " enable_freetype = true" >> ${freetype_gni} || die
echo "}" >> ${freetype_gni} || die
# See dependency logic in third_party/BUILD.gn
myconf_gn+=" use_system_harfbuzz=$(usex system-harfbuzz true false)"
@ -1157,6 +1042,11 @@ chromium_configure() {
# Don't need nocompile checks and GN crashes with our config
myconf_gn+=" enable_nocompile_tests=false"
# 131 began laying the groundwork for replacing freetype with
# "Rust-based Fontations set of libraries plus Skia path rendering"
# We now need to opt-in
myconf_gn+=" enable_freetype=true"
# Enable ozone wayland and/or headless support
myconf_gn+=" use_ozone=true ozone_auto_platforms=false"
myconf_gn+=" ozone_platform_headless=true"
@ -1169,7 +1059,6 @@ chromium_configure() {
myconf_gn+=" enable_print_preview=false"
myconf_gn+=" enable_remoting=false"
else
myconf_gn+=" use_system_libdrm=true"
myconf_gn+=" use_system_minigbm=true"
myconf_gn+=" use_xkbcommon=true"
if use qt5 || use qt6; then
@ -1211,9 +1100,6 @@ chromium_configure() {
# Allow building against system libraries in official builds
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
tools/generate_shim_headers/generate_shim_headers.py || die
# This may need to be filtered on non-amd64 arches
# Also these options are listed in upstream docs: use_cfi_icall=true use_cfi_cast=true (This may be for testing only?)
# https://www.chromium.org/developers/testing/control-flow-integrity/
myconf_gn+=" is_cfi=${use_lto}"
# Don't add symbols to build
myconf_gn+=" symbol_level=0"
@ -1245,6 +1131,7 @@ src_configure() {
}
chromium_compile() {
# Final link uses lots of file descriptors.
ulimit -n 2048
@ -1270,25 +1157,10 @@ chromium_compile() {
# Even though ninja autodetects number of CPUs, we respect
# user's options, for debugging with -j 1 or any other reason.
eninja -C out/Release chrome chromedriver chrome_sandbox
eninja -C out/Release chrome chromedriver chrome_sandbox $(use test && echo "base_unittests")
pax-mark m out/Release/chrome
if ! use system-toolchain; then
QA_FLAGS_IGNORED="
usr/lib64/chromium-browser/chrome
usr/lib64/chromium-browser/chrome-sandbox
usr/lib64/chromium-browser/chromedriver
usr/lib64/chromium-browser/chrome_crashpad_handler
usr/lib64/chromium-browser/libEGL.so
usr/lib64/chromium-browser/libGLESv2.so
usr/lib64/chromium-browser/libVkICD_mock_icd.so
usr/lib64/chromium-browser/libVkLayer_khronos_validation.so
usr/lib64/chromium-browser/libqt5_shim.so
usr/lib64/chromium-browser/libvk_swiftshader.so
usr/lib64/chromium-browser/libvulkan.so.1
"
fi
}
# This function is called from virtx, and must always return so that Xvfb
@ -1367,6 +1239,58 @@ src_compile() {
out/Release/vk_swiftshader_icd.json || die
}
src_test() {
# Initial list of tests to skip pulled from Alpine. Thanks Lauren!
# https://issues.chromium.org/issues/40939315
local skip_tests=(
'MessagePumpLibeventTest.NestedNotification*'
ClampTest.Death
OptionalTest.DereferencingNoValueCrashes
PlatformThreadTest.SetCurrentThreadTypeTest
RawPtrTest.TrivialRelocability
SafeNumerics.IntMaxOperations
StackTraceTest.TraceStackFramePointersFromBuffer
StringPieceTest.InvalidLengthDeath
StringPieceTest.OutOfBoundsDeath
ThreadPoolEnvironmentConfig.CanUseBackgroundPriorityForWorker
ValuesUtilTest.FilePath
# Gentoo-specific
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/3
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/0
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/1
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/2
AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/3
CharacterEncodingTest.GetCanonicalEncodingNameByAliasName
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGFPE
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGILL
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGV
CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGVNonCanonicalAddress
FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe
FileTest.GetInfoForCreationTime
ICUStringConversionsTest.ConvertToUtf8AndNormalize
NumberFormattingTest.FormatPercent
PathServiceTest.CheckedGetFailure
PlatformThreadTest.CanChangeThreadType
RustLogIntegrationTest.CheckAllSeverity
StackCanary.ChangingStackCanaryCrashesOnReturn
StackTraceDeathTest.StackDumpSignalHandlerIsMallocFree
SysStrings.SysNativeMBAndWide
SysStrings.SysNativeMBToWide
SysStrings.SysWideToNativeMB
TestLauncherTools.TruncateSnippetFocusedMatchesFatalMessagesTest
ToolsSanityTest.BadVirtualCallNull
ToolsSanityTest.BadVirtualCallWrongType
)
local test_filter="-$(IFS=:; printf '%s' "${skip_tests[*]}")"
# test-launcher-bot-mode enables parallelism and plain output
./out/Release/base_unittests --test-launcher-bot-mode \
--test-launcher-jobs="$(makeopts_jobs)" \
--gtest_filter="${test_filter}" || die "Tests failed!"
}
src_install() {
local CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
exeinto "${CHROMIUM_HOME}"

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -11,13 +11,6 @@ bindgen (in our rust toolchain), but distributions may want to
override this and use a system path.
Additionally enable distros to feed in appropriate library paths.
---
build/config/rust.gni | 11 +++++++++++
build/rust/rust_bindgen.gni | 28 ++++++++++++++++++----------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/build/config/rust.gni b/build/config/rust.gni
index 97e788a227..78b9daa7e8 100644
--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -60,6 +60,17 @@ declare_args() {
@ -38,8 +31,6 @@ index 97e788a227..78b9daa7e8 100644
# If you're using a Rust toolchain as specified by rust_sysroot_absolute,
# set this to the output of `rustc -V`. Changing this string will cause all
# Rust targets to be rebuilt, which allows you to update your toolchain and
diff --git a/build/rust/rust_bindgen.gni b/build/rust/rust_bindgen.gni
index bf110ca93c..d7eb04eb00 100644
--- a/build/rust/rust_bindgen.gni
+++ b/build/rust/rust_bindgen.gni
@@ -16,13 +16,13 @@ if (host_os == "win") {

View file

@ -1,73 +0,0 @@
https://github.com/chromium/chromium/commit/570332aad61afab5d9d88a8438bae53ea28a298a
From: Noah Rose Ledesma <noahrose@google.com>
Date: Wed, 31 Jul 2024 17:59:12 +0000
Subject: [PATCH] Use libs instead of pkg_config for linux deps
pkg_config can cause builds to fail if the requested packages are not
present, regardless of if the lib is depended upon by the target being
built.
This issue can be avoided by setting 'libs' instead. I'm not sure why we
didn't do so in the first place.
Bug: 355967882
Change-Id: Ie5dc4c03b08d7c1e26458ea143f6dc812b670544
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5749680
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Commit-Queue: Noah Rose Ledesma <noahrose@google.com>
Cr-Commit-Position: refs/heads/main@{#1335558}
--- a/chrome/updater/BUILD.gn
+++ b/chrome/updater/BUILD.gn
@@ -367,9 +367,10 @@ if (is_win || is_mac || is_linux) {
"update_service_internal_impl_qualifying_linux.cc",
"update_usage_stats_task_linux.cc",
]
- public_configs = [
- "linux:libcurl",
- "linux:libsystemd",
+
+ libs = [
+ "curl",
+ "systemd",
]
}
}
@@ -1040,7 +1041,7 @@ if (is_win || is_mac || is_linux) {
data += [ "//chrome/test/data/updater/updater_qualification_app.crx" ]
data_deps += [ "//chrome/updater/linux:updater_test" ]
- public_configs = [ "linux:libsystemd" ]
+ libs = [ "systemd" ]
}
if (is_posix) {
--- a/chrome/updater/linux/BUILD.gn
+++ b/chrome/updater/linux/BUILD.gn
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("//build/config/linux/pkg_config.gni")
import("//chrome/updater/zip.gni")
# This target builds the updater executable and unittests.
@@ -13,18 +12,10 @@ group("linux") {
]
}
-pkg_config("libcurl") {
- packages = [ "libcurl" ]
-}
-
-pkg_config("libsystemd") {
- packages = [ "libsystemd" ]
-}
-
source_set("updater_executable") {
sources = [ "main.cc" ]
deps = [ "//chrome/updater:base" ]
- public_configs = [ ":libsystemd" ]
+ libs = [ "systemd" ]
}
executable("updater") {

View file

@ -0,0 +1,104 @@
From 84b3b8335f7efbb8ed5ab9c9a260ea4f5d77192b Mon Sep 17 00:00:00 2001
From: Matt Jolly <kangie@gentoo.org>
Date: Mon, 11 Nov 2024 20:52:48 +1000
Subject: [PATCH] Make bindgen wrapper work with unbundled toolchain
The `run_bindgen.py` wrapper takes a --libclang-path option
and uses it to set the appropriate environment variable.
This is currently hardcoded to use libclang shipped alongside
bindgen (in our rust toolchain), but distributions may want to
override this and use a system path.
Additionally enable distros to feed in appropriate library paths.
--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -60,6 +60,17 @@ declare_args() {
# the bindgen exectuable).
rust_bindgen_root = "//third_party/rust-toolchain"
+ # Directory under which to find one of `libclang.{dll,so}` (a `lib[64]` or
+ # `bin` directory containing the libclang shared library).
+ # We don't need to worry about multlib, but specify the full path here
+ # in case a distribution does.
+ if (host_os == "win") {
+ bindgen_libclang_path = "//third_party/rust-toolchain/bin"
+ } else {
+ bindgen_libclang_path = "//third_party/rust-toolchain/lib"
+ }
+
+
# If you're using a Rust toolchain as specified by rust_sysroot_absolute,
# set this to the output of `rustc -V`. Changing this string will cause all
# Rust targets to be rebuilt, which allows you to update your toolchain and
--- a/build/rust/rust_bindgen.gni
+++ b/build/rust/rust_bindgen.gni
@@ -17,13 +17,13 @@ if (host_os == "win") {
_bindgen_path = "${_bindgen_path}.exe"
}
-# On Windows, the libclang.dll is beside the bindgen.exe, otherwise it is in
-# ../lib.
-_libclang_path = rust_bindgen_root
-if (host_os == "win") {
- _libclang_path += "/bin"
+if (clang_base_path != default_clang_base_path && custom_toolchain == "//build/toolchain/linux/unbundle:default") {
+ # Assume that the user has set this up properly, including handling multilib
+ _clang_libpath = clang_base_path + "/include"
+ _clang_ld_libpath = bindgen_libclang_path
} else {
- _libclang_path += "/lib"
+ _clang_libpath = clang_base_path + "/lib/clang/" + clang_version
+ _clang_ld_libpath = clang_base_path + "/lib"
}
# Template to build Rust/C bindings with bindgen.
--- a/build/rust/rust_bindgen_generator.gni
+++ b/build/rust/rust_bindgen_generator.gni
@@ -151,7 +151,7 @@ template("rust_bindgen_generator") {
"--output",
rebase_path(output_file, root_build_dir),
"--libclang-path",
- rebase_path(_libclang_path, root_build_dir),
+ rebase_path(bindgen_libclang_path, root_build_dir),
]
if (_wrap_static_fns) {
@@ -172,7 +172,7 @@ template("rust_bindgen_generator") {
# point to.
args += [
"--ld-library-path",
- rebase_path(clang_base_path + "/lib", root_build_dir),
+ rebase_path(bindgen_libclang_path, root_build_dir),
]
}
@@ -215,9 +215,7 @@ template("rust_bindgen_generator") {
# says the wrong thing. We point it to our clang's resource dir which will
# make it behave consistently with our other command line flags and allows
# system headers to be found.
- clang_resource_dir =
- rebase_path(clang_base_path + "/lib/clang/" + clang_version,
- root_build_dir)
+ clang_resource_dir = rebase_path(clang_base_path + "/include", root_build_dir)
args += [
"-resource-dir",
clang_resource_dir,
@@ -238,6 +236,15 @@ template("rust_bindgen_generator") {
}
}
+ if (custom_toolchain == "//build/toolchain/linux/unbundle:default") {
+ # We need to pass the path to the libstdc++ headers to bindgen so that it
+ # can find them when parsing C++ headers.
+ args += [
+ "-I",
+ rebase_path(clang_base_path + "/include/", root_build_dir),
+ ]
+ }
+
if (is_win) {
# On Windows we fall back to using system headers from a sysroot from
# depot_tools. This is negotiated by python scripts and the result is
--
2.47.0

View file

@ -22,7 +22,6 @@
<flag name="system-harfbuzz">Use system <pkg>media-libs/harfbuzz</pkg> instead of the bundled library.</flag>
<flag name="system-icu">Use system <pkg>dev-libs/icu</pkg> instead of the bundled one</flag>
<flag name="system-png">Use system <pkg>media-libs/libpng</pkg> instead of the bundled library</flag>
<flag name="system-toolchain">Use system toolchain instead of the bundled one (if possible)</flag>
<flag name="system-zstd">Use system <pkg>app-arch/zstd</pkg> instead of the bundled one.</flag>
<flag name="widevine">Unsupported closed-source DRM capability (required by Netflix VOD)</flag>
</use>