-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
236 additions
and
107 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
diff --git a/runtime/errors.rs b/runtime/errors.rs | ||
index 4268fbd50..d09aec325 100644 | ||
--- a/runtime/errors.rs | ||
+++ b/runtime/errors.rs | ||
@@ -299,6 +299,7 @@ fn get_webgpu_byow_error_class( | ||
deno_webgpu::byow::ByowError::CreateSurface(_) => "Error", | ||
deno_webgpu::byow::ByowError::InvalidSystem => "TypeError", | ||
#[cfg(any( | ||
+ target_os = "android", | ||
target_os = "windows", | ||
target_os = "linux", | ||
target_os = "freebsd", | ||
@@ -306,6 +307,7 @@ fn get_webgpu_byow_error_class( | ||
))] | ||
deno_webgpu::byow::ByowError::NullWindow => "TypeError", | ||
#[cfg(any( | ||
+ target_os = "android", | ||
target_os = "linux", | ||
target_os = "freebsd", | ||
target_os = "openbsd" |
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,29 @@ | ||
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs | ||
index cb85859f7..891ebb0e2 100644 | ||
--- a/cli/tools/upgrade.rs | ||
+++ b/cli/tools/upgrade.rs | ||
@@ -480,6 +480,7 @@ async fn fetch_and_store_latest_version< | ||
env.write_check_file(&version_file.serialize()); | ||
} | ||
|
||
+#[cfg(not(target_os = "android"))] | ||
pub async fn upgrade( | ||
flags: Arc<Flags>, | ||
upgrade_flags: UpgradeFlags, | ||
@@ -612,6 +613,16 @@ pub async fn upgrade( | ||
Ok(()) | ||
} | ||
|
||
+#[cfg(target_os = "android")] | ||
+pub async fn upgrade( | ||
+ flags: Arc<Flags>, | ||
+ upgrade_flags: UpgradeFlags, | ||
+) -> Result<(), AnyError> { | ||
+ log::error!("You are currently using Deno packaged by the Termux repo. Upgrading Deno via CLI will cause an issue to installed Deno. Wait for an update on Deno package in the Termux repo to upgrade."); | ||
+ deno_runtime::exit(1); | ||
+} | ||
+ | ||
+ | ||
#[derive(Debug, PartialEq)] | ||
enum RequestedVersion { | ||
Latest(ReleaseChannel), |
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 @@ | ||
diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts | ||
index edc89ed2c..ae24b53a1 100644 | ||
--- a/ext/node/polyfills/os.ts | ||
+++ b/ext/node/polyfills/os.ts | ||
@@ -287,7 +287,7 @@ export function tmpdir(): string | null { | ||
return temp; | ||
} else { // !isWindows | ||
let temp = Deno.env.get("TMPDIR") || Deno.env.get("TMP") || | ||
- Deno.env.get("TEMP") || "/tmp"; | ||
+ Deno.env.get("TEMP") || "@TERMUX_PREFIX@/tmp"; | ||
if (temp.length > 1 && StringPrototypeEndsWith(temp, "/")) { | ||
temp = StringPrototypeSlice(temp, 0, -1); | ||
} |
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,53 @@ | ||
diff --git a/ext/webgpu/byow.rs b/ext/webgpu/byow.rs | ||
index c9e1177b1..dee840119 100644 | ||
--- a/ext/webgpu/byow.rs | ||
+++ b/ext/webgpu/byow.rs | ||
@@ -5,6 +5,7 @@ use deno_core::OpState; | ||
use deno_core::ResourceId; | ||
use std::ffi::c_void; | ||
#[cfg(any( | ||
+ target_os = "android", | ||
target_os = "linux", | ||
target_os = "macos", | ||
target_os = "freebsd", | ||
@@ -29,6 +30,7 @@ pub enum ByowError { | ||
#[error("Invalid system on macOS")] | ||
InvalidSystem, | ||
#[cfg(any( | ||
+ target_os = "android", | ||
target_os = "linux", | ||
target_os = "freebsd", | ||
target_os = "openbsd" | ||
@@ -36,6 +38,7 @@ pub enum ByowError { | ||
#[error("Invalid system on Linux/BSD")] | ||
InvalidSystem, | ||
#[cfg(any( | ||
+ target_os = "android", | ||
target_os = "windows", | ||
target_os = "linux", | ||
target_os = "freebsd", | ||
@@ -44,6 +47,7 @@ pub enum ByowError { | ||
#[error("window is null")] | ||
NullWindow, | ||
#[cfg(any( | ||
+ target_os = "android", | ||
target_os = "linux", | ||
target_os = "freebsd", | ||
target_os = "openbsd" | ||
@@ -150,7 +154,7 @@ fn raw_window( | ||
Ok((win_handle, display_handle)) | ||
} | ||
|
||
-#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] | ||
+#[cfg(any(target_os = "android", target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] | ||
fn raw_window( | ||
system: &str, | ||
window: *const c_void, | ||
@@ -188,6 +192,7 @@ fn raw_window( | ||
} | ||
|
||
#[cfg(not(any( | ||
+ target_os = "android", | ||
target_os = "macos", | ||
target_os = "windows", | ||
target_os = "linux", |
13 changes: 13 additions & 0 deletions
13
packages/deno/0005-dont-enable-libsqlite3-sys-bundled-feature.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 @@ | ||
diff --git a/Cargo.toml b/Cargo.toml | ||
index 987c291fc..7e8cbda03 100644 | ||
--- a/Cargo.toml | ||
+++ b/Cargo.toml | ||
@@ -166,7 +166,7 @@ rand = "=0.8.5" | ||
regex = "^1.7.0" | ||
reqwest = { version = "=0.12.5", default-features = false, features = ["rustls-tls", "stream", "gzip", "brotli", "socks", "json", "http2"] } # pinned because of https://github.com/seanmonstar/reqwest/pull/1955 | ||
ring = "^0.17.0" | ||
-rusqlite = { version = "0.32.0", features = ["unlock_notify", "bundled"] } | ||
+rusqlite = { version = "0.32.0", features = ["unlock_notify"] } | ||
rustls = { version = "0.23.11", default-features = false, features = ["logging", "std", "tls12", "ring"] } | ||
rustls-pemfile = "2" | ||
rustls-tokio-stream = "=0.3.0" |
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,55 @@ | ||
TERMUX_PKG_HOMEPAGE=https://deno.land/ | ||
TERMUX_PKG_DESCRIPTION="A modern runtime for JavaScript and TypeScript" | ||
TERMUX_PKG_LICENSE="MIT" | ||
TERMUX_PKG_MAINTAINER="@termux" | ||
TERMUX_PKG_VERSION=2.1.2 | ||
TERMUX_PKG_SRCURL=git+https://github.com/denoland/deno | ||
TERMUX_PKG_DEPENDS="libsqlite, glib" | ||
TERMUX_PKG_BUILD_DEPENDS="librusty-v8" | ||
TERMUX_PKG_BUILD_IN_SRC=true | ||
|
||
# See https://github.com/denoland/deno/issues/2295#issuecomment-2329248010 | ||
TERMUX_PKG_BLACKLISTED_ARCHES="i686, arm" | ||
|
||
termux_step_configure() { | ||
termux_setup_rust | ||
termux_setup_cmake | ||
termux_setup_protobuf | ||
|
||
: "${CARGO_HOME:=$HOME/.cargo}" | ||
export CARGO_HOME | ||
|
||
cargo vendor | ||
patch --silent -p1 \ | ||
-d ./vendor/v8/ \ | ||
< "$TERMUX_PKG_BUILDER_DIR"/rusty-v8-search-files-with-target-suffix.diff | ||
|
||
patch --silent -p1 \ | ||
-d "$TERMUX_PKG_SRCDIR" \ | ||
< "$TERMUX_PKG_BUILDER_DIR"/patch-root-Cargo.diff | ||
} | ||
|
||
termux_step_make() { | ||
local env_name=RUSTY_V8_ARCHIVE_${CARGO_TARGET_NAME@U} | ||
env_name=${env_name//-/_} | ||
export "$env_name"="${TERMUX_PREFIX}/lib/librusty_v8.a" | ||
env_name=RUSTY_V8_SRC_BINDING_PATH_${CARGO_TARGET_NAME@U} | ||
env_name=${env_name//-/_} | ||
export "$env_name"="${TERMUX_PREFIX}/include/librusty_v8/src_binding.rs" | ||
|
||
export DENO_SKIP_CROSS_BUILD_CHECK=1 | ||
|
||
# Workaround libz-sys trying to build zlib-ng with CMake | ||
export TARGET_CMAKE_TOOLCHAIN_FILE="/dev/null" | ||
|
||
# Workaround for C compiler used in aarch64 build | ||
if [[ "${TERMUX_ARCH}" == "aarch64" ]]; then | ||
export CFLAGS="--target=${TERMUX_HOST_PLATFORM} ${CFLAGS-}" | ||
fi | ||
|
||
cargo build --jobs "${TERMUX_PKG_MAKE_PROCESSES}" --target "${CARGO_TARGET_NAME}" --release | ||
} | ||
|
||
termux_step_make_install() { | ||
install -Dm700 -t "${TERMUX_PREFIX}/bin" "target/${CARGO_TARGET_NAME}/release/deno" | ||
} |
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,9 @@ | ||
--- a/Cargo.toml | ||
+++ b/Cargo.toml | ||
@@ -334,3 +334,6 @@ | ||
opt-level = 3 | ||
[profile.release.package.zstd-sys] | ||
opt-level = 3 | ||
+ | ||
+[patch.crates-io] | ||
+v8 = { path = "./vendor/v8" } |
42 changes: 42 additions & 0 deletions
42
packages/deno/rusty-v8-search-files-with-target-suffix.diff
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.rs | ||
+++ b/build.rs | ||
@@ -55,6 +55,16 @@ | ||
println!("cargo:rerun-if-env-changed={}", env); | ||
} | ||
|
||
+ // Also rebuild for some vars with target suffix | ||
+ let envs2 = vec![ | ||
+ "RUSTY_V8_ARCHIVE", | ||
+ "RUSTY_V8_SRC_BINDING_PATH", | ||
+ ]; | ||
+ for env in envs2 { | ||
+ let target = env::var("TARGET").unwrap().replace("-", "_").to_uppercase(); | ||
+ println!("cargo:rerun-if-env-changed={}_{}", env, target); | ||
+ } | ||
+ | ||
// Detect if trybuild tests are being compiled. | ||
let is_trybuild = env::var_os("DENO_TRYBUILD").is_some(); | ||
|
||
@@ -407,6 +417,10 @@ | ||
} | ||
|
||
fn static_lib_url() -> String { | ||
+ let target_u = env::var("TARGET").unwrap().replace("-", "_").to_uppercase(); | ||
+ if let Ok(custom_archive_u) = env::var(format!("RUSTY_V8_ARCHIVE_{}", target_u)) { | ||
+ return custom_archive_u; | ||
+ } | ||
if let Ok(custom_archive) = env::var("RUSTY_V8_ARCHIVE") { | ||
return custom_archive; | ||
} | ||
@@ -681,6 +695,11 @@ | ||
} | ||
|
||
fn print_prebuilt_src_binding_path() { | ||
+ let target_u = env::var("TARGET").unwrap().replace("-", "_").to_uppercase(); | ||
+ if let Ok(binding_u) = env::var(format!("RUSTY_V8_SRC_BINDING_PATH_{}", target_u)) { | ||
+ println!("cargo:rustc-env=RUSTY_V8_SRC_BINDING_PATH={}", binding_u); | ||
+ return; | ||
+ } | ||
if let Ok(binding) = env::var("RUSTY_V8_SRC_BINDING_PATH") { | ||
println!("cargo:rustc-env=RUSTY_V8_SRC_BINDING_PATH={}", binding); | ||
return; |
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