summaryrefslogtreecommitdiffstats
path: root/chromium/MAKEPKG
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/MAKEPKG')
-rw-r--r--chromium/MAKEPKG228
1 files changed, 228 insertions, 0 deletions
diff --git a/chromium/MAKEPKG b/chromium/MAKEPKG
new file mode 100644
index 0000000..4674fe9
--- /dev/null
+++ b/chromium/MAKEPKG
@@ -0,0 +1,228 @@
1#!/bin/mkpkg
2# description: Open-source web browser
3# url: https://www.chromium.org/
4#
5# Patches:
6# copium — musl basics (Alpine/selfisekai)
7# gentoo — system toolchain support (Matt Jolly)
8# patches/ — musl deep fixes (Chimera cports + flux)
9
10name=chromium
11version=146.0.7680.164
12release=1
13_copium=146.4
14_gentoo=146-1
15depends=(gtk3 nss nspr harfbuzz icu libpng libjpeg-turbo libwebp
16 zlib libxml2 fontconfig freetype libffi libxkbcommon alsa-lib
17 wayland mesa libdrm dbus)
18makedeps=(gn ninja rust rust-bindgen python3 nodejs flatbuffers gperf
19 bsd-headers gcc-compat)
20source=(https://github.com/chromium-linux-tarballs/chromium-tarballs/releases/download/$version/chromium-$version-linux.tar.xz
21 https://registry.npmjs.org/@rollup/wasm-node/-/wasm-node-4.53.3.tgz
22 https://codeberg.org/selfisekai/copium/archive/$_copium.tar.gz
23 https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/$_gentoo/chromium-patches-$_gentoo.tar.gz)
24
25patch() {
26 cd chromium-$version
27
28 # Replace bundled rollup with wasm-node (pure WASM — no native binary needed on musl)
29 rm -rf third_party/devtools-frontend/src/node_modules/rollup
30 cp -a "$SRC"/package \
31 third_party/devtools-frontend/src/node_modules/rollup
32
33 # Copium patches (musl basics)
34 for p in "$SRC"/copium/cr*.patch; do
35 case "$p" in *rust-pre1.8*|*rust-pre1.90*|*no-unrar*) continue ;; esac
36 patch -Np1 -i "$p"
37 done
38
39 # Gentoo patches (system toolchain)
40 patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-145-compiler.patch
41 patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-144-bindgen-custom-toolchain.patch
42 patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-117-material-color-include.patch
43 patch -Np1 -i "$SRC"/chromium-patches-$_gentoo/chromium-145-revert-rustfmt.patch || true
44
45 # flux musl patches
46 for p in \
47 008-fstatat64 \
48 016-musl-sandbox \
49 017-musl-tid-caching \
50 019-musl-no-execinfo \
51 020-musl-no-mallinfo \
52 021-musl-no-res-ninit \
53 022-no-sandbox-settls \
54 027-temp-failure-retry \
55 033-perfetto-get-thread-name \
56 035-breakpad-no-getcontext \
57 disable-dns_config_service \
58 noclanglibs \
59 sanitizer-no-death-callback \
60 terminal-fdset \
61 llvm21-fixes \
62 ; do
63 patch -Np1 -i "$PKGMK_SOURCE_DIR"/patches/$p.patch
64 done
65
66 # Rust target triple
67 sed -i 's/unknown-linux-gnu/unknown-linux-musl/g' build/config/rust.gni
68 echo 'x86_64-unknown-linux-musl' >> build/rust/known-target-triples.txt
69
70 # Enable nightly Rust features
71 sed -i '1a import os; os.environ["RUSTC_BOOTSTRAP"] = "1"' \
72 build/rust/gni_impl/rustc_wrapper.py
73
74 # Strip -Werror
75 sed -i 's/-Werror//g' build/config/compiler/BUILD.gn
76
77 # musl: libc++ rune table
78 sed -i '1i #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE' \
79 third_party/libc++/src/include/__config
80
81 # musl: guard glibc-only stack trace helper
82 sed -i 's/OutputToStreamWithPrefixImpl(os, prefix_string);/#if defined(__GLIBC__)\n OutputToStreamWithPrefixImpl(os, prefix_string);\n#endif/' \
83 base/debug/stack_trace.cc
84
85 # Fix dbus::Bus incomplete type
86 sed -i '/chrome_browser_main_linux.h/a #include "dbus/bus.h"' \
87 chrome/browser/chrome_browser_main_linux.cc
88}
89
90sha256sums=(
91 "ea7350702cb827c94b786fc1fa51c24c0401e782c9c08dd7ca25a676da4a8f8c"
92 "04b101456db24503a6facaade777f4bfb58909195208d4dbbf7dc4217bf71289"
93 "bd7bd0984d048d6844195f4aa18b24a0f56603814c243ed32190746d8ba8d7c5"
94 "96d6562120964b0c9e1a2bedf4335e0bf20f5e7d67a443bb26c651b0167a6a6b"
95)
96
97build() {
98 cd chromium-$version
99
100 export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib LD=ld.lld
101 export CFLAGS="-O2 -pipe -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations"
102 export CXXFLAGS="$CFLAGS -Wno-invalid-constexpr"
103 export LDFLAGS="-fuse-ld=lld"
104 export RUSTC_BOOTSTRAP=1
105 export DEPOT_TOOLS_UPDATE=0
106 export VPYTHON_BYPASS="manually managed python not supported by chrome operations"
107 export PKG_CONFIG_PATH=/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
108 export HOME="$PWD"/fake-home && mkdir -p "$HOME"
109
110 # System node + toolchain stubs
111 mkdir -p third_party/node/linux/node-linux-x64/bin
112 ln -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/node
113 mkdir -p third_party/llvm-build/Release+Asserts/bin
114 ln -sf /usr/bin/clang third_party/llvm-build/Release+Asserts/bin/
115 ln -sf /usr/bin/clang++ third_party/llvm-build/Release+Asserts/bin/
116
117 # Stub node version check
118 printf '#!/usr/bin/env python3\nimport sys; open(sys.argv[sys.argv.index("--out_file")+1], "w").write("ok")\n' \
119 > third_party/node/check_version.py
120
121 mkdir -p out/Release
122 cat > out/Release/args.gn << EOF
123is_clang = true
124use_lld = true
125is_debug = false
126is_official_build = true
127symbol_level = 0
128is_musl = true
129custom_toolchain = "//build/toolchain/linux/unbundle:default"
130host_toolchain = "//build/toolchain/linux/unbundle:default"
131rust_sysroot_absolute = "$(rustc --print sysroot)"
132rust_bindgen_root = "/usr"
133bindgen_libclang_path = "/usr/lib"
134clang_base_path = "/usr"
135rustc_version = "0"
136use_sysroot = false
137treat_warnings_as_errors = false
138fatal_linker_warnings = false
139clang_use_chrome_plugins = false
140use_custom_libcxx = true
141use_safe_libstdcxx = false
142chrome_pgo_phase = 0
143is_cfi = false
144use_thin_lto = false
145use_clang_modules = false
146blink_enable_generated_code_formatting = false
147use_system_harfbuzz = true
148use_system_libffi = true
149use_bundled_fontconfig = false
150use_ozone = true
151ozone_platform_wayland = true
152ozone_platform_x11 = false
153ozone_platform_headless = true
154use_xkbcommon = true
155use_alsa = true
156use_pulseaudio = false
157rtc_use_pipewire = false
158use_vaapi = true
159use_dbus = true
160use_cups = false
161use_kerberos = false
162enable_widevine = false
163enable_hangout_services_extension = false
164enable_nocompile_tests = false
165safe_browsing_use_unrar = false
166proprietary_codecs = true
167ffmpeg_branding = "Chrome"
168enable_ml_internal = false
169target_cpu = "x64"
170EOF
171
172 gn gen out/Release || return 1
173
174 # Remove bogus -I/include from generated ninja files
175 find out/Release -name '*.ninja' -exec sed -i 's| -I/include||g; s| -isystem/include||g' {} +
176
177 # System flatbuffers
178 ln -sf /usr/bin/flatc out/Release/flatc
179
180 ulimit -n 4096
181 ninja -C out/Release -j8 chrome chrome_crashpad_handler || return 1
182
183 # Install
184 d="$PKG/usr/lib/chromium"
185 install -d "$d" "$PKG/usr/bin"
186
187 install -m755 out/Release/chrome "$d/"
188 install -m755 out/Release/chrome_crashpad_handler "$d/"
189
190 # Data files
191 install -m644 out/Release/*.pak "$d/"
192 install -m644 out/Release/*.bin "$d/" 2>/dev/null || true
193 [ -f out/Release/icudtl.dat ] && install -m644 out/Release/icudtl.dat "$d/"
194
195 # Shared libraries (skip .TOC build artifacts)
196 for f in out/Release/*.so out/Release/*.so.*; do
197 [ -f "$f" ] && case "$f" in *.TOC) continue ;; esac && install -m644 "$f" "$d/"
198 done
199
200 # Vulkan SwiftShader ICD
201 [ -f out/Release/vk_swiftshader_icd.json ] && install -m644 out/Release/vk_swiftshader_icd.json "$d/"
202
203 # XDG helpers
204 for f in xdg-mime xdg-settings; do
205 [ -f out/Release/$f ] && install -m755 out/Release/$f "$d/"
206 done
207
208 # Locales — only en-US and el (Greek)
209 install -d "$d/locales"
210 for loc in en-US el; do
211 install -m644 out/Release/locales/${loc}.pak "$d/locales/"
212 for v in FEMININE MASCULINE NEUTER; do
213 [ -f out/Release/locales/${loc}_${v}.pak ] && \
214 install -m644 out/Release/locales/${loc}_${v}.pak "$d/locales/"
215 done
216 done
217
218 # Wrapper
219 printf '#!/bin/sh\nexec /usr/lib/chromium/chrome --ozone-platform-hint=auto "$@"\n' > "$PKG/usr/bin/chromium"
220 chmod 755 "$PKG/usr/bin/chromium"
221}
222
223signify() {
224 untrusted comment: public key
225 RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
226}
227
228# vim: filetype=sh