diff --git a/disabled-packages/deno/build.sh b/disabled-packages/deno/build.sh deleted file mode 100644 index 406c113570db1fc..000000000000000 --- a/disabled-packages/deno/build.sh +++ /dev/null @@ -1,61 +0,0 @@ -TERMUX_PKG_HOMEPAGE=https://deno.land/ -TERMUX_PKG_DESCRIPTION="A modern runtime for JavaScript and TypeScript" -TERMUX_PKG_LICENSE="MIT" -TERMUX_PKG_MAINTAINER="@termux" -_COMMIT=1259a3f48c00e95a8bb0964e4dabfa769a20bcde -_COMMIT_DATE=2022.01.19 -TERMUX_PKG_VERSION=1.17.3p${_COMMIT_DATE//./} -TERMUX_PKG_REVISION=2 -TERMUX_PKG_SRCURL=git+https://github.com/denoland/deno -TERMUX_PKG_GIT_BRANCH=main -TERMUX_PKG_DEPENDS="libffi" -#TERMUX_PKG_BUILD_DEPENDS="librusty-v8" -TERMUX_PKG_BUILD_IN_SRC=true - -# Due to dependency on librusty-v8. -TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686, x86_64" - -termux_step_post_get_source() { - git fetch --unshallow - git checkout $_COMMIT - - local version="$(git log -1 --format=%cs | sed 's/-/./g')" - if [ "$version" != "$_COMMIT_DATE" ]; then - echo -n "ERROR: The specified commit date \"$_COMMIT_DATE\"" - echo " is different from what is expected to be: \"$version\"" - return 1 - fi - - git submodule update --init --recursive -} - -termux_step_pre_configure() { - termux_setup_rust - - if [ "$TERMUX_DEBUG_BUILD" = "true" ]; then - BUILD_TYPE=debug - else - BUILD_TYPE=release - fi -} - -termux_step_make() { - local libdir=target/$CARGO_TARGET_NAME/$BUILD_TYPE/deps - mkdir -p $libdir - ln -sf $TERMUX_PREFIX/lib/libffi.so $libdir/ - local libgcc="$($CC -print-libgcc-file-name)" - echo "INPUT($libgcc -l:libunwind.a)" > $libdir/libgcc.so - local cmd="cargo build --jobs $TERMUX_PKG_MAKE_PROCESSES \ - --target $CARGO_TARGET_NAME" - if [ "$TERMUX_DEBUG_BUILD" = "false" ]; then - cmd+=" --release" - fi - #$cmd || : - #ln -sf $TERMUX_PREFIX/lib/librusty_v8.a \ - # target/$CARGO_TARGET_NAME/release/gn_out/obj/librusty_v8.a - $cmd -} - -termux_step_make_install() { - install -Dm700 -t $TERMUX_PREFIX/bin target/${CARGO_TARGET_NAME}/$BUILD_TYPE/deno -} diff --git a/disabled-packages/deno/cli-tools-upgrade.rs.patch b/disabled-packages/deno/cli-tools-upgrade.rs.patch deleted file mode 100644 index 9a0a28c22559f64..000000000000000 --- a/disabled-packages/deno/cli-tools-upgrade.rs.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ./cli/tools/upgrade.rs.orig 2022-01-20 19:18:16.459123964 +0530 -+++ ./cli/tools/upgrade.rs 2022-01-20 19:27:18.071118123 +0530 -@@ -22,6 +22,7 @@ - - const RELEASE_URL: &str = "https://github.com/denoland/deno/releases"; - -+#[cfg(not(target_os = "android"))] - pub async fn upgrade(upgrade_flags: UpgradeFlags) -> Result<(), AnyError> { - let mut client_builder = Client::builder(); - -@@ -135,6 +136,12 @@ - Ok(()) - } - -+#[cfg(target_os = "android")] -+pub async fn upgrade(upgrade_flags: UpgradeFlags) -> Result<(), AnyError> { -+ println!("You are currently using Deno packaged by the Termux repo. To upgrade Deno, wait for the packagers to update it. This is done to prevent you from breaking your installation."); -+ std::process::exit(1); -+} -+ - async fn get_latest_release_version( - client: &Client, - ) -> Result { diff --git a/disabled-packages/deno/ext-ffi-Cargo.toml.patch b/disabled-packages/deno/ext-ffi-Cargo.toml.patch deleted file mode 100644 index 2416aecafa45ef0..000000000000000 --- a/disabled-packages/deno/ext-ffi-Cargo.toml.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/ext/ffi/Cargo.toml -+++ b/ext/ffi/Cargo.toml -@@ -16,7 +16,7 @@ - [dependencies] - deno_core = { version = "0.114.0", path = "../../core" } - dlopen = "0.1.8" --libffi = "2.0.0" -+libffi = { version = "2.0.0", features = ["system"] } - serde = { version = "1.0.129", features = ["derive"] } - tokio = { version = "1.10.1", features = ["full"] } - diff --git a/disabled-packages/deno/runtime-ops-signal.rs.patch b/disabled-packages/deno/runtime-ops-signal.rs.patch deleted file mode 100644 index fc1067939366e8d..000000000000000 --- a/disabled-packages/deno/runtime-ops-signal.rs.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/runtime/ops/signal.rs -+++ b/runtime/ops/signal.rs -@@ -97,7 +97,7 @@ - } - } - --#[cfg(target_os = "linux")] -+#[cfg(any(target_os = "linux", target_os = "android"))] - pub fn signal_str_to_int(s: &str) -> Result { - match s { - "SIGHUP" => Ok(1), diff --git a/packages/deno/0001-fix-runtime-errors.patch b/packages/deno/0001-fix-runtime-errors.patch new file mode 100644 index 000000000000000..b0ec641a3bbecc8 --- /dev/null +++ b/packages/deno/0001-fix-runtime-errors.patch @@ -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" diff --git a/packages/deno/0002-disable-upgrading-via-cli.patch b/packages/deno/0002-disable-upgrading-via-cli.patch new file mode 100644 index 000000000000000..fd02cd731bfbc5a --- /dev/null +++ b/packages/deno/0002-disable-upgrading-via-cli.patch @@ -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, + upgrade_flags: UpgradeFlags, +@@ -612,6 +613,16 @@ pub async fn upgrade( + Ok(()) + } + ++#[cfg(target_os = "android")] ++pub async fn upgrade( ++ flags: Arc, ++ 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), diff --git a/packages/deno/0003-fix-tmp-path.patch b/packages/deno/0003-fix-tmp-path.patch new file mode 100644 index 000000000000000..ecfb8fd2dd4b7f2 --- /dev/null +++ b/packages/deno/0003-fix-tmp-path.patch @@ -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); + } diff --git a/packages/deno/0004-fix-webgpu-compilation.patch b/packages/deno/0004-fix-webgpu-compilation.patch new file mode 100644 index 000000000000000..cb2be3626f12304 --- /dev/null +++ b/packages/deno/0004-fix-webgpu-compilation.patch @@ -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", diff --git a/packages/deno/0005-dont-enable-libsqlite3-sys-bundled-feature.patch b/packages/deno/0005-dont-enable-libsqlite3-sys-bundled-feature.patch new file mode 100644 index 000000000000000..760c695a8942a79 --- /dev/null +++ b/packages/deno/0005-dont-enable-libsqlite3-sys-bundled-feature.patch @@ -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" diff --git a/packages/deno/build.sh b/packages/deno/build.sh new file mode 100644 index 000000000000000..420a4b224ea3403 --- /dev/null +++ b/packages/deno/build.sh @@ -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" +} diff --git a/packages/deno/patch-root-Cargo.diff b/packages/deno/patch-root-Cargo.diff new file mode 100644 index 000000000000000..99d52b45f72bb09 --- /dev/null +++ b/packages/deno/patch-root-Cargo.diff @@ -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" } diff --git a/packages/deno/rusty-v8-search-files-with-target-suffix.diff b/packages/deno/rusty-v8-search-files-with-target-suffix.diff new file mode 100644 index 000000000000000..7590da40a2380ba --- /dev/null +++ b/packages/deno/rusty-v8-search-files-with-target-suffix.diff @@ -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; diff --git a/packages/libsqlite/build.sh b/packages/libsqlite/build.sh index 6ddcff25075f9fd..514276503d24fb8 100644 --- a/packages/libsqlite/build.sh +++ b/packages/libsqlite/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Library implementing a self-contained and transactional TERMUX_PKG_LICENSE="Public Domain" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="3.47.1" +TERMUX_PKG_REVISION=1 _SQLITE_YEAR=2024 TERMUX_PKG_SRCURL=https://www.sqlite.org/${_SQLITE_YEAR}/sqlite-autoconf-$(sed 's/\./''/; s/\./0/' <<< "$TERMUX_PKG_VERSION")00.tar.gz TERMUX_PKG_SHA256=416a6f45bf2cacd494b208fdee1beda509abda951d5f47bc4f2792126f01b452 @@ -17,7 +18,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" " termux_step_pre_configure() { - CPPFLAGS+=" -Werror -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1" + CPPFLAGS+=" -Werror -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1" LDFLAGS+=" -lm" }