-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skip ci]
- Loading branch information
Showing
71 changed files
with
2,515 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
tur-electron/electron-32/0002-compiler-use-android-target.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- a/build/config/compiler/BUILD.gn | ||
+++ b/build/config/compiler/BUILD.gn | ||
@@ -960,8 +960,8 @@ | ||
} else if (current_cpu == "arm") { | ||
if (is_clang && !is_android && !is_nacl && | ||
!(is_chromeos_lacros && is_chromeos_device)) { | ||
- cflags += [ "--target=arm-linux-gnueabihf" ] | ||
- ldflags += [ "--target=arm-linux-gnueabihf" ] | ||
+ cflags += [ "--target=armv7a-linux-android24" ] | ||
+ ldflags += [ "--target=armv7a-linux-android24" ] | ||
} | ||
if (!is_nacl) { | ||
cflags += [ | ||
@@ -975,8 +975,8 @@ | ||
} else if (current_cpu == "arm64") { | ||
if (is_clang && !is_android && !is_nacl && !is_fuchsia && | ||
!(is_chromeos_lacros && is_chromeos_device)) { | ||
- cflags += [ "--target=aarch64-linux-gnu" ] | ||
- ldflags += [ "--target=aarch64-linux-gnu" ] | ||
+ cflags += [ "--target=aarch64-linux-android24" ] | ||
+ ldflags += [ "--target=aarch64-linux-android24" ] | ||
} | ||
} else if (current_cpu == "mipsel" && !is_nacl) { | ||
ldflags += [ "-Wl,--hash-style=sysv" ] |
14 changes: 14 additions & 0 deletions
14
tur-electron/electron-32/0003-compiler-disable-warnings.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- a/build/config/compiler/BUILD.gn | ||
+++ b/build/config/compiler/BUILD.gn | ||
@@ -1919,6 +1912,11 @@ | ||
} | ||
} | ||
|
||
+ cflags += [ | ||
+ "-Wno-unknown-warning-option", | ||
+ "-Wno-unknown-pragmas", | ||
+ ] | ||
+ | ||
# Rust warnings | ||
|
||
# Require `unsafe` blocks even in `unsafe` fns. This is intended to become |
45 changes: 45 additions & 0 deletions
45
tur-electron/electron-32/0004-compiler-clang-lib-dir.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- a/build/config/clang/clang.gni | ||
+++ b/build/config/clang/clang.gni | ||
@@ -35,6 +35,9 @@ | ||
# Set to true to enable output of ThinLTO index and import files used for | ||
# creating a Chromium MLGO corpus in the ThinLTO case. | ||
lld_emit_indexes_and_imports = false | ||
+ | ||
+ custom_toolchain_clang_base_path = "" | ||
+ custom_toolchain_clang_version = "" | ||
} | ||
|
||
# We don't really need to collect a corpus for the host tools, just for the target. | ||
--- a/build/config/clang/BUILD.gn | ||
+++ b/build/config/clang/BUILD.gn | ||
@@ -5,6 +5,8 @@ | ||
import("//build/config/rust.gni") | ||
import("clang.gni") | ||
|
||
+import("//v8/gni/snapshot_toolchain.gni") | ||
+ | ||
if (is_ios) { | ||
import("//build/config/ios/config.gni") # For `target_environment` | ||
} | ||
@@ -186,6 +186,21 @@ | ||
} | ||
|
||
_clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib" | ||
+ | ||
+ if (is_a_target_toolchain && current_toolchain != v8_snapshot_toolchain) { | ||
+ _dir = "linux" | ||
+ _clang_lib_dir = "$custom_toolchain_clang_base_path/lib/clang/$custom_toolchain_clang_version/lib" | ||
+ if (current_cpu == "x64") { | ||
+ _suffix = "-x86_64-android" | ||
+ } else if (current_cpu == "arm") { | ||
+ _suffix = "-arm-android" | ||
+ } else if (current_cpu == "arm64") { | ||
+ _suffix = "-aarch64-android" | ||
+ } else { | ||
+ assert(false) # Unhandled cpu type | ||
+ } | ||
+ } | ||
+ | ||
_lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}" | ||
libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ] | ||
} |
42 changes: 42 additions & 0 deletions
42
tur-electron/electron-32/0005-compiler-custom-rust-abi-target-triple.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- a/build/config/rust.gni | ||
+++ b/build/config/rust.gni | ||
@@ -7,6 +7,8 @@ | ||
import("//build/config/sanitizers/sanitizers.gni") | ||
import("//build/toolchain/toolchain.gni") | ||
|
||
+import("//v8/gni/snapshot_toolchain.gni") | ||
+ | ||
if (is_android) { | ||
import("//build/config/android/config.gni") | ||
} | ||
@@ -98,6 +100,8 @@ | ||
# a platform. Mostly applicable to Windows, where new versions can handle ANSI | ||
# escape sequences but it's not reliable in general. | ||
force_rustc_color_output = false | ||
+ | ||
+ custom_target_rust_abi_target = "" | ||
} | ||
|
||
# Use a separate declare_args so these variables' defaults can depend on the | ||
@@ -165,7 +169,7 @@ | ||
# TODO(crbug.com/1278030): To build unit tests for Android we need to build | ||
# them as a dylib and put them into an APK. We should reuse all the same logic | ||
# for gtests from the `//testing/test:test` template. | ||
-can_build_rust_unit_tests = toolchain_has_rust && !is_android | ||
+can_build_rust_unit_tests = toolchain_has_rust && !is_android && false | ||
|
||
# We want to store rust_sysroot as a source-relative variable for ninja | ||
# portability. In practice if an external toolchain was specified, it might | ||
@@ -280,6 +284,12 @@ | ||
} | ||
} | ||
|
||
+if (!toolchain_for_rust_host_build_tools && current_toolchain != v8_snapshot_toolchain && current_toolchain != host_toolchain) { | ||
+ if (custom_target_rust_abi_target != "") { | ||
+ rust_abi_target = custom_target_rust_abi_target | ||
+ } | ||
+} | ||
+ | ||
assert(!toolchain_has_rust || rust_abi_target != "") | ||
|
||
# This variable is passed to the Rust libstd build. |
20 changes: 20 additions & 0 deletions
20
tur-electron/electron-32/0006-compiler-use-custom-libcxx-for-v8.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- a/build/config/c++/c++.gni | ||
+++ b/build/config/c++/c++.gni | ||
@@ -6,6 +6,8 @@ | ||
import("//build/config/sanitizers/sanitizers.gni") | ||
import("//build_overrides/build.gni") | ||
|
||
+import("//v8/gni/snapshot_toolchain.gni") | ||
+ | ||
declare_args() { | ||
# Use in-tree libc++ (buildtools/third_party/libc++ and | ||
# buildtools/third_party/libc++abi) instead of the system C++ library for C++ | ||
@@ -42,6 +44,8 @@ | ||
|
||
use_custom_libcxx = | ||
use_custom_libcxx || (use_custom_libcxx_for_host && !is_a_target_toolchain) | ||
+use_custom_libcxx = | ||
+ use_custom_libcxx || (use_custom_libcxx_for_host && current_toolchain == v8_snapshot_toolchain) | ||
use_custom_libcxx = use_custom_libcxx && !is_nacl | ||
|
||
declare_args() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- a/build/gn_run_binary.py | ||
+++ b/build/gn_run_binary.py | ||
@@ -23,7 +23,19 @@ | ||
# The rest of the arguments are passed directly to the executable. | ||
args = [path] + sys.argv[2:] | ||
|
||
-ret = subprocess.call(args) | ||
+# Modified by Termux: When building for termux, this wrapper will | ||
+# be used to run the binary which is built for host machine, using | ||
+# the rootfs provided by Google. We need to set LD_PRELOAD with | ||
+# libffi.so.7 as the host machine (Ubuntu 24.04) doesn't provide it. | ||
+envs = os.environ.copy() | ||
+if "./clang_x86_v8_arm/" in path or "./clang_x86/" in path: | ||
+ base_sysroot = os.path.join(os.path.dirname(__file__), "linux", "debian_bullseye_i386-sysroot") | ||
+ envs["LD_PRELOAD"] = base_sysroot + "/usr/lib/i386-linux-gnu/libffi.so.7" | ||
+elif "./host/" in path or "./clang_x64_v8_arm64/" in path or "./clang_x64/" in path: | ||
+ base_sysroot = os.path.join(os.path.dirname(__file__), "linux", "debian_bullseye_amd64-sysroot") | ||
+ envs["LD_PRELOAD"] = base_sysroot + "/usr/lib/x86_64-linux-gnu/libffi.so.7" | ||
+ | ||
+ret = subprocess.call(args, env=envs) | ||
if ret != 0: | ||
if ret <= -100: | ||
# Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to |
13 changes: 13 additions & 0 deletions
13
tur-electron/electron-32/0008-remove-xorg-from-build-deps-2.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This reverts https://github.com/chromium/chromium/commit/97c864b32a7f4d64f541e2b7bf9006d2f582082f | ||
|
||
--- a/build/install-build-deps.py | ||
+++ b/build/install-build-deps.py | ||
@@ -388,8 +388,6 @@ | ||
"libxtst6", | ||
"x11-utils", | ||
"x11-xserver-utils", | ||
- "xserver-xorg-core", | ||
- "xserver-xorg-video-dummy", | ||
"xvfb", | ||
"zlib1g", | ||
] |
95 changes: 95 additions & 0 deletions
95
tur-electron/electron-32/1001-chromium-disable-sandbox.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- a/content/shell/app/shell_main_delegate.cc | ||
+++ b/content/shell/app/shell_main_delegate.cc | ||
@@ -90,6 +90,10 @@ | ||
#include "content/shell/app/ios/shell_application_ios.h" | ||
#endif | ||
|
||
+#ifdef __TERMUX__ | ||
+#include "sandbox/policy/switches.h" | ||
+#endif | ||
+ | ||
namespace { | ||
|
||
#if !BUILDFLAG(IS_FUCHSIA) | ||
@@ -210,6 +214,15 @@ | ||
base::CPU cpu_info; | ||
#endif | ||
|
||
+// Disable sandbox on Termux. | ||
+#ifdef __TERMUX__ | ||
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | ||
+ sandbox::policy::switches::kNoSandbox)) { | ||
+ base::CommandLine::ForCurrentProcess()->AppendSwitch( | ||
+ sandbox::policy::switches::kNoSandbox); | ||
+ } | ||
+#endif | ||
+ | ||
// Disable platform crash handling and initialize the crash reporter, if | ||
// requested. | ||
// TODO(crbug.com/1226159): Implement crash reporter integration for Fuchsia. | ||
--- a/chrome/browser/ui/startup/bad_flags_prompt.cc | ||
+++ b/chrome/browser/ui/startup/bad_flags_prompt.cc | ||
@@ -60,10 +60,12 @@ | ||
static const char* kBadFlags[] = { | ||
network::switches::kIgnoreCertificateErrorsSPKIList, | ||
// These flags disable sandbox-related security. | ||
+#ifndef __TERMUX__ | ||
sandbox::policy::switches::kDisableGpuSandbox, | ||
sandbox::policy::switches::kDisableSeccompFilterSandbox, | ||
sandbox::policy::switches::kDisableSetuidSandbox, | ||
sandbox::policy::switches::kNoSandbox, | ||
+#endif | ||
#if BUILDFLAG(IS_WIN) | ||
sandbox::policy::switches::kAllowThirdPartyModules, | ||
#endif | ||
--- a/chrome/app/chrome_main_delegate.cc | ||
+++ b/chrome/app/chrome_main_delegate.cc | ||
@@ -235,6 +235,10 @@ | ||
#include "ui/gfx/switches.h" | ||
#endif | ||
|
||
+#ifdef __TERMUX__ | ||
+#include "sandbox/policy/switches.h" | ||
+#endif | ||
+ | ||
base::LazyInstance<ChromeContentGpuClient>::DestructorAtExit | ||
g_chrome_content_gpu_client = LAZY_INSTANCE_INITIALIZER; | ||
base::LazyInstance<ChromeContentRendererClient>::DestructorAtExit | ||
@@ -1037,6 +1041,14 @@ | ||
const base::CommandLine& command_line = | ||
*base::CommandLine::ForCurrentProcess(); | ||
|
||
+// Disable sandbox on Termux. | ||
+#ifdef __TERMUX__ | ||
+ if (!command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) { | ||
+ base::CommandLine::ForCurrentProcess()->AppendSwitch( | ||
+ sandbox::policy::switches::kNoSandbox); | ||
+ } | ||
+#endif | ||
+ | ||
// Only allow disabling web security via the command-line flag if the user has | ||
// specified a distinct profile directory. This still enables tests to disable | ||
// web security by setting the kWebKitWebSecurityEnabled pref directly. | ||
--- a/content/shell/browser/shell_content_browser_client.cc | ||
+++ b/content/shell/browser/shell_content_browser_client.cc | ||
@@ -131,6 +131,10 @@ | ||
#include "media/mojo/services/media_foundation_preferences.h" | ||
#endif // BUILDFLAG(IS_WIN) | ||
|
||
+#ifdef __TERMUX__ | ||
+#include "sandbox/policy/switches.h" | ||
+#endif | ||
+ | ||
namespace content { | ||
|
||
namespace { | ||
@@ -405,6 +409,9 @@ | ||
// to shell_main.cc that it's a browser test. | ||
switches::kBrowserTest, | ||
#endif | ||
+#ifdef __TERMUX__ | ||
+ sandbox::policy::switches::kNoSandbox | ||
+#endif | ||
switches::kCrashDumpsDir, | ||
switches::kEnableCrashReporter, | ||
switches::kExposeInternalsForTesting, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/base/files/file_util_posix.cc | ||
+++ b/base/files/file_util_posix.cc | ||
@@ -1111,7 +1111,7 @@ | ||
#if !BUILDFLAG(IS_ANDROID) | ||
// This is implemented in file_util_android.cc for that platform. | ||
bool GetShmemTempDir(bool executable, FilePath* path) { | ||
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX) | ||
+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)) && !defined(__TERMUX__) | ||
bool disable_dev_shm = false; | ||
#if !BUILDFLAG(IS_CHROMEOS) | ||
disable_dev_shm = CommandLine::ForCurrentProcess()->HasSwitch( |
11 changes: 11 additions & 0 deletions
11
tur-electron/electron-32/1003-chromium-fix-type-for-inotify.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/base/files/file_path_watcher_inotify.cc | ||
+++ b/base/files/file_path_watcher_inotify.cc | ||
@@ -114,7 +114,7 @@ | ||
class InotifyReader { | ||
public: | ||
// Watch descriptor used by AddWatch() and RemoveWatch(). | ||
-#if BUILDFLAG(IS_ANDROID) | ||
+#if BUILDFLAG(IS_ANDROID) || defined(__TERMUX__) | ||
using Watch = uint32_t; | ||
#else | ||
using Watch = int; |
14 changes: 14 additions & 0 deletions
14
tur-electron/electron-32/1004-chromium-headless-disable-sandbox-by-default.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- a/headless/lib/headless_content_main_delegate.cc | ||
+++ b/headless/lib/headless_content_main_delegate.cc | ||
@@ -176,6 +176,11 @@ | ||
if (!command_line->HasSwitch(::switches::kHeadless)) | ||
command_line->AppendSwitch(::switches::kHeadless); | ||
|
||
+#ifdef __TERMUX__ | ||
+ // Always pass no sandbox on Termux. | ||
+ command_line->AppendSwitch(sandbox::policy::switches::kNoSandbox); | ||
+#endif | ||
+ | ||
// Use software rendering by default, but don't mess with gl and angle | ||
// switches if user is overriding them. | ||
if (!command_line->HasSwitch(::switches::kUseGL) && |
Oops, something went wrong.