diff --git a/packages/locustdb/build.sh b/packages/locustdb/build.sh new file mode 100644 index 000000000..ae09a928a --- /dev/null +++ b/packages/locustdb/build.sh @@ -0,0 +1,42 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/cswinter/LocustDB +TERMUX_PKG_DESCRIPTION="An experimental analytics database" +TERMUX_PKG_LICENSE="Apache-2.0" +TERMUX_PKG_LICENSE_FILE="LICENSE" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=0.3.4 +TERMUX_PKG_SRCURL=https://github.com/cswinter/LocustDB/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=b4ac9e44edc541522b7663ebbb6dfeafaf58a1a4fd060e86af59ed3baec6574a +TERMUX_PKG_BUILD_IN_SRC=true + +# ``` +# error: this arithmetic operation will overflow +# --> src/locustdb.rs:189:36 +# | +# 189 | mem_size_limit_tables: 8 * 1024 * 1024 * 1024, // 8 GiB +# | ^^^^^^^^^^^^^^^^^^^^^^ attempt to multiply with overflow +# | +# = note: `#[deny(arithmetic_overflow)]` on by default +# ``` +TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686" + +termux_step_make() { + termux_setup_rust + : "${CARGO_HOME:=$HOME/.cargo}" + export CARGO_HOME + + cargo fetch --target $CARGO_TARGET_NAME + for p in errno sched termios; do + patch --silent -p1 \ + -d $CARGO_HOME/registry/src/github.com-*/nix-0.5.1 \ + < $TERMUX_PKG_BUILDER_DIR/nix-0.5.1-${p}.diff + done + patch --silent -p1 \ + -d $CARGO_HOME/registry/src/github.com-*/rustyline-1.0.0 \ + < $TERMUX_PKG_BUILDER_DIR/rustyline-1.0.0-ioctl.diff + + cargo build --jobs $TERMUX_MAKE_PROCESSES --target $CARGO_TARGET_NAME --release +} + +termux_step_make_install() { + install -Dm700 -T target/${CARGO_TARGET_NAME}/release/repl $TERMUX_PREFIX/bin/locustdb +} diff --git a/packages/locustdb/nix-0.5.1-errno.diff b/packages/locustdb/nix-0.5.1-errno.diff new file mode 100644 index 000000000..394f7a325 --- /dev/null +++ b/packages/locustdb/nix-0.5.1-errno.diff @@ -0,0 +1,18 @@ +--- a/src/errno.rs ++++ b/src/errno.rs +@@ -29,13 +29,13 @@ + __dfly_error() + } + +-#[cfg(any(target_os = "openbsd", target_os = "netbsd"))] ++#[cfg(any(target_os = "openbsd", target_os = "netbsd", target_os = "android"))] + unsafe fn errno_location() -> *mut c_int { + extern { fn __errno() -> *mut c_int; } + __errno() + } + +-#[cfg(any(target_os = "linux", target_os = "android"))] ++#[cfg(target_os = "linux")] + unsafe fn errno_location() -> *mut c_int { + extern { fn __errno_location() -> *mut c_int; } + __errno_location() diff --git a/packages/locustdb/nix-0.5.1-sched.diff b/packages/locustdb/nix-0.5.1-sched.diff new file mode 100644 index 000000000..eda53abe5 --- /dev/null +++ b/packages/locustdb/nix-0.5.1-sched.diff @@ -0,0 +1,20 @@ +--- a/src/sched.rs ++++ b/src/sched.rs +@@ -36,7 +36,7 @@ + } + + // Support a maximum CPU set of 1024 nodes +-#[cfg(all(target_arch = "x86_64", target_os = "linux"))] ++#[cfg(all(target_arch = "x86_64", any(target_os = "linux", target_os = "android")))] + mod cpuset_attribs { + use super::CpuMask; + pub const CPU_SETSIZE: usize = 1024; +@@ -53,7 +53,7 @@ + } + } + +-#[cfg(all(target_arch = "x86", target_os = "linux"))] ++#[cfg(all(target_arch = "x86", any(target_os = "linux", target_os = "android")))] + mod cpuset_attribs { + use super::CpuMask; + pub const CPU_SETSIZE: usize = 1024; diff --git a/packages/locustdb/nix-0.5.1-termios.diff b/packages/locustdb/nix-0.5.1-termios.diff new file mode 100644 index 000000000..54a495b58 --- /dev/null +++ b/packages/locustdb/nix-0.5.1-termios.diff @@ -0,0 +1,31 @@ +--- a/src/sys/termios.rs ++++ b/src/sys/termios.rs +@@ -11,7 +11,7 @@ + mod ffi { + pub use self::consts::*; + +- #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", target_os = "linux"))] ++ #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", target_os = "linux", target_os = "android"))] + mod non_android { + use super::consts::*; + use libc::c_int; +@@ -35,9 +35,10 @@ + } + } + +- #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", target_os = "linux"))] ++ #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", target_os = "linux", target_os = "android"))] + pub use self::non_android::*; + ++ /* + // On Android before 5.0, Bionic directly inline these to ioctl() calls. + #[inline] + #[cfg(all(target_os = "android", not(target_arch = "mips")))] +@@ -92,6 +93,7 @@ + + #[cfg(target_os = "android")] + pub use self::android::*; ++ */ + + + #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))] diff --git a/packages/locustdb/rustyline-1.0.0-ioctl.diff b/packages/locustdb/rustyline-1.0.0-ioctl.diff new file mode 100644 index 000000000..1f26d524a --- /dev/null +++ b/packages/locustdb/rustyline-1.0.0-ioctl.diff @@ -0,0 +1,15 @@ +--- a/src/tty/unix.rs ++++ b/src/tty/unix.rs +@@ -23,10 +23,10 @@ + #[cfg(any(target_os = "macos", target_os = "freebsd"))] + const TIOCGWINSZ: libc::c_ulong = 0x40087468; + +-#[cfg(any(all(target_os = "linux", target_env = "gnu"), target_os = "android"))] ++#[cfg(all(target_os = "linux", target_env = "gnu"))] + const TIOCGWINSZ: libc::c_ulong = 0x5413; + +-#[cfg(all(target_os = "linux", target_env = "musl"))] ++#[cfg(any(all(target_os = "linux", target_env = "musl"), target_os = "android"))] + const TIOCGWINSZ: libc::c_int = 0x5413; + + /// Try to get the number of columns in the current terminal,