@@ -2,8 +2,8 @@ TERMUX_PKG_HOMEPAGE=https://github.com/electron/electron
22TERMUX_PKG_DESCRIPTION=" Build cross-platform desktop apps with JavaScript, HTML, and CSS"
33TERMUX_PKG_LICENSE=" MIT, BSD 3-Clause"
44TERMUX_PKG_MAINTAINER=
" Chongyun Lee <[email protected] >" 5- _CHROMIUM_VERSION=114 .0.5735.289
6- TERMUX_PKG_VERSION=25.8.0
5+ _CHROMIUM_VERSION=122 .0.6261.156
6+ TERMUX_PKG_VERSION=29.3.1
77TERMUX_PKG_SRCURL=git+https://github.com/electron/electron
88TERMUX_PKG_DEPENDS=" electron-deps"
99TERMUX_PKG_BUILD_DEPENDS=" libnotify, libffi-static"
@@ -34,21 +34,31 @@ __tur_chromium_sudo() {
3434 env -i PATH=" $PATH " sudo " $@ "
3535}
3636
37- termux_step_get_source () {
38- # Fetch depot_tools
37+ __tur_setup_depot_tools () {
3938 export DEPOT_TOOLS_UPDATE=0
4039 if [ ! -f " $TERMUX_PKG_CACHEDIR /.depot_tools-fetched" ]; then
4140 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $TERMUX_PKG_CACHEDIR /depot_tools
4241 touch " $TERMUX_PKG_CACHEDIR /.depot_tools-fetched"
4342 fi
4443 export PATH=" $TERMUX_PKG_CACHEDIR /depot_tools:$PATH "
44+ export CHROMIUM_BUILDTOOLS_PATH=" $TERMUX_PKG_SRCDIR /buildtools"
45+ }
46+
47+ termux_step_get_source () {
48+ # Fetch depot_tools
49+ __tur_setup_depot_tools
4550
4651 # Fetch chromium source
47- local __cr_src_dir=" $HOME /chromium"
52+ local __cr_src_dir=" $HOME /chromium-sources/chromium "
4853 if [ ! -f " $TERMUX_PKG_CACHEDIR /.chromium-source-fetched" ]; then
4954 mkdir -p " $__cr_src_dir "
5055 pushd " $__cr_src_dir "
51- fetch --nohooks chromium || gclient sync --nohooks
56+ fetch --nohooks chromium || (
57+ cd src && git reset --hard && git checkout main && git pull &&
58+ _remote_main=" $( git rev-parse origin/main) " && cd .. &&
59+ gclient sync --nohooks --verbose --revision src@$_remote_main &&
60+ gclient fetch --verbose
61+ )
5262 pushd src
5363 gclient runhooks
5464 popd # "$__cr_src_dir/src"
@@ -60,20 +70,25 @@ termux_step_get_source() {
6070 termux_setup_nodejs
6171
6272 # Fetch electron source without checking out chromium source
63- local __electron_src_dir=" $HOME /electron"
73+ local __electron_src_dir=" $HOME /chromium-sources/ electron"
6474 if [ ! -f " $TERMUX_PKG_CACHEDIR /.electron-source-fetched" ]; then
6575 mkdir -p " $__electron_src_dir "
6676 pushd " $__electron_src_dir "
6777 gclient config --name " src/electron" --unmanaged https://github.com/electron/electron --custom-var=checkout_chromium=False --verbose
68- gclient sync --with_branch_heads --with_tags --verbose
78+ gclient fetch --verbose
79+ gclient sync --nohooks --with_branch_heads --with_tags --verbose
80+ (cd src/electron && git reset --hard && git checkout main && git pull &&
81+ _remote_main=" $( git rev-parse origin/main) " && cd ../.. &&
82+ gclient sync --nohooks --with_branch_heads --with_tags --verbose --revision src/electron@$_remote_main &&
83+ gclient fetch --verbose)
6984 popd # "$__electron_src_dir"
7085 touch " $TERMUX_PKG_CACHEDIR /.electron-source-fetched"
7186 fi
7287
7388 # Layer 1, contains the source code of given version
74- local __layer1_dir=" $HOME /electron-layer-1"
75- local __layer1_delete=false
76- if [ " $__layer1_delete " = true ]; then
89+ local __layer1_dir=" $TERMUX_PKG_CACHEDIR /electron-layer-1"
90+ local __layer1_marker_file= " $TERMUX_PKG_CACHEDIR /.layer1-fetched "
91+ if [ ! -f " $__layer1_marker_file " ] || [ " $( cat $__layer1_marker_file ) " != " $TERMUX_PKG_VERSION " ]; then
7792 if __tur_chromium_is_mountpoint " $__layer1_dir /merged" ; then
7893 __tur_chromium_sudo umount " $__layer1_dir /merged"
7994 fi
@@ -88,14 +103,15 @@ termux_step_get_source() {
88103 gclient config --name " src/electron" --unmanaged https://github.com/electron/electron --verbose
89104 gclient sync --revision v$TERMUX_PKG_VERSION --verbose
90105 popd # "$__layer1_dir/merged"
106+ echo " $TERMUX_PKG_VERSION " > " $__layer1_marker_file "
91107 else
92108 if ! __tur_chromium_is_mountpoint " $__layer1_dir /merged" ; then
93109 __tur_chromium_sudo mount -t overlay -o lowerdir=$__electron_src_dir :$__cr_src_dir ,upperdir=$__layer1_dir /upperdir,workdir=$__layer1_dir /workdir overlay $__layer1_dir /merged
94110 fi
95111 fi
96112
97113 # Layer 2, the real work dir, waiting for patches
98- local __layer2_dir=" $HOME /electron-layer-2"
114+ local __layer2_dir=" $TERMUX_PKG_CACHEDIR /electron-layer-2"
99115 if __tur_chromium_is_mountpoint " $__layer2_dir /merged" ; then
100116 __tur_chromium_sudo umount " $__layer2_dir /merged"
101117 fi
@@ -125,9 +141,9 @@ termux_step_post_get_source() {
125141
126142termux_step_configure () {
127143 cd $TERMUX_PKG_SRCDIR
128- termux_setup_gn
129144 termux_setup_ninja
130145 termux_setup_nodejs
146+ __tur_setup_depot_tools
131147
132148 # Remove termux's dummy pkg-config
133149 local _target_pkg_config=$( command -v pkg-config)
@@ -137,18 +153,23 @@ termux_step_configure() {
137153 ln -s $_host_pkg_config $TERMUX_PKG_TMPDIR /host-pkg-config-bin/pkg-config
138154 export PATH=" $TERMUX_PKG_TMPDIR /host-pkg-config-bin:$PATH "
139155
156+ # Install deps
140157 env -i PATH=" $PATH " sudo apt update
141158 env -i PATH=" $PATH " sudo apt install lsb-release -yq
142159 env -i PATH=" $PATH " sudo apt install libfontconfig1 libffi7 libfontconfig1:i386 libffi7:i386 -yq
143160 env -i PATH=" $PATH " sudo ./build/install-build-deps.sh --lib32 --no-syms --no-android --no-arm --no-chromeos-fonts --no-nacl --no-prompt
144161
145162 # Install amd64 rootfs if necessary, it should have been installed by source hooks.
146- build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
163+ build/linux/sysroot_scripts/install-sysroot.py --sysroots-json-path=build/linux/sysroot_scripts/sysroots.json -- arch=amd64
147164 local _amd64_sysroot_path=" $( pwd) /build/linux/$( ls build/linux | grep ' amd64-sysroot' ) "
165+ rm -rf " $_amd64_sysroot_path "
166+ build/linux/sysroot_scripts/install-sysroot.py --sysroots-json-path=build/linux/sysroot_scripts/sysroots.json --arch=amd64
148167
149168 # Install i386 rootfs if necessary, it should have been installed by source hooks.
150- build/linux/sysroot_scripts/install-sysroot.py --arch=i386
169+ build/linux/sysroot_scripts/install-sysroot.py --sysroots-json-path=build/linux/sysroot_scripts/sysroots.json -- arch=i386
151170 local _i386_sysroot_path=" $( pwd) /build/linux/$( ls build/linux | grep ' i386-sysroot' ) "
171+ rm -rf " $_i386_sysroot_path "
172+ build/linux/sysroot_scripts/install-sysroot.py --sysroots-json-path=build/linux/sysroot_scripts/sysroots.json --arch=i386
152173
153174 # Link to system tools required by the build
154175 mkdir -p third_party/node/linux/node-linux-x64/bin
@@ -181,13 +202,17 @@ termux_step_configure() {
181202 cp -Rf $TERMUX_PREFIX /include/* usr/include
182203 cp -Rf $TERMUX_PREFIX /lib/* usr/lib
183204 ln -sf /data ./data
205+ # This is needed to build crashpad
206+ rm -rf $TERMUX_PREFIX /include/spawn.h
184207 # This is needed to build cups
185208 cp -Rf $TERMUX_PREFIX /bin/cups-config usr/bin/
186209 chmod +x usr/bin/cups-config
210+ # Cherry-pick LWG3545 for NDK r26
211+ patch -p1 < $TERMUX_SCRIPTDIR /common-files/chromium-patches/sysroot-patches/libcxx-17-lwg3545.diff
187212 popd
188213
189214 # Construct args
190- local _clang_base_path=" /usr/lib/llvm-15 "
215+ local _clang_base_path=" /usr/lib/llvm-16 "
191216 local _host_cc=" $_clang_base_path /bin/clang"
192217 local _host_cxx=" $_clang_base_path /bin/clang++"
193218 local _target_cpu _target_sysroot=" $TERMUX_PKG_TMPDIR /sysroot"
@@ -196,17 +221,17 @@ termux_step_configure() {
196221 _target_cpu=" arm64"
197222 _v8_current_cpu=" x64"
198223 _v8_sysroot_path=" $_amd64_sysroot_path "
199- _v8_toolchain_name=" clang_x64_v8_arm64 "
224+ _v8_toolchain_name=" clang_x64_v8_arm64_ "
200225 elif [ " $TERMUX_ARCH " = " arm" ]; then
201226 _target_cpu=" arm"
202227 _v8_current_cpu=" x86"
203228 _v8_sysroot_path=" $_i386_sysroot_path "
204- _v8_toolchain_name=" clang_x86_v8_arm "
229+ _v8_toolchain_name=" clang_x86_v8_arm_ "
205230 elif [ " $TERMUX_ARCH " = " x86_64" ]; then
206231 _target_cpu=" x64"
207232 _v8_current_cpu=" x64"
208233 _v8_sysroot_path=" $_amd64_sysroot_path "
209- _v8_toolchain_name=" clang_x64 "
234+ _v8_toolchain_name=" clang_x64_ "
210235 fi
211236
212237 local _common_args_file=$TERMUX_PKG_TMPDIR /common-args-file
@@ -215,6 +240,7 @@ termux_step_configure() {
215240
216241 echo "
217242import(\" //electron/build/args/release.gn\" )
243+ override_electron_version = \" $TERMUX_PKG_VERSION \"
218244# Do not build with symbols
219245symbol_level = 0
220246# Use our custom toolchain
@@ -234,14 +260,14 @@ treat_warnings_as_errors = false
234260use_bundled_fontconfig = false
235261use_system_freetype = false
236262use_system_libdrm = true
263+ use_system_libffi = true
237264use_custom_libcxx = false
238265use_allocator_shim = false
239266use_partition_alloc_as_malloc = false
240267enable_backup_ref_ptr_support = false
241268enable_pointer_compression_support = false
242269use_nss_certs = true
243270use_udev = false
244- use_gnome_keyring = false
245271use_alsa = false
246272use_libpci = false
247273use_pulseaudio = true
@@ -253,11 +279,16 @@ ozone_platform_wayland = true
253279ozone_platform_headless = true
254280angle_enable_vulkan = true
255281angle_enable_swiftshader = true
282+ angle_enable_abseil = false
256283rtc_use_pipewire = false
257- use_vaapi_x11 = false
284+ use_vaapi = false
258285# See comments on Chromium package
259286enable_nacl = false
260- use_thin_lto=false
287+ is_cfi = false
288+ use_cfi_icall = false
289+ use_thin_lto = false
290+ enable_rust = false
291+ llvm_android_mainline = true
261292" >> $_common_args_file
262293
263294 if [ " $TERMUX_ARCH " = " arm" ]; then
@@ -290,14 +321,20 @@ use_thin_lto=false
290321 s|@V8_SYSROOT@|$_v8_sysroot_path |g
291322 " $TERMUX_PKG_CACHEDIR /custom-toolchain/BUILD.gn
292323
324+ # Cherry-pick LWG3545 for GCC
325+ patch -p1 -d $_amd64_sysroot_path < $TERMUX_SCRIPTDIR /common-files/chromium-patches/sysroot-patches/libstdcxx3-10-lwg3545.diff
326+ if [ " $_v8_sysroot_path " != " $_amd64_sysroot_path " ]; then
327+ patch -p1 -d $_v8_sysroot_path < $TERMUX_SCRIPTDIR /common-files/chromium-patches/sysroot-patches/libstdcxx3-10-lwg3545.diff
328+ fi
329+
293330 mkdir -p $TERMUX_PKG_BUILDDIR /out/Release
294331 cat $_common_args_file > $TERMUX_PKG_BUILDDIR /out/Release/args.gn
295- gn gen $TERMUX_PKG_BUILDDIR /out/Release --export-compile-commands
332+ gn gen $TERMUX_PKG_BUILDDIR /out/Release --export-compile-commands || bash
296333}
297334
298335termux_step_make () {
299336 cd $TERMUX_PKG_BUILDDIR
300- ninja -C $TERMUX_PKG_BUILDDIR /out/Release third_party/electron_node:headers electron electron_license chromium_licenses -k 0
337+ ninja -C $TERMUX_PKG_BUILDDIR /out/Release electron:node_headers electron electron_license chromium_licenses -k 0 || bash
301338}
302339
303340termux_step_make_install () {
0 commit comments