mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-02-06 10:02:18 +00:00
addpkg(main/oxlint): 1.2.0
- Fixes https://github.com/termux/termux-packages/issues/25122
- Based loosely on Arch Linux package: c9feb24ebe/PKGBUILD
This commit is contained in:
22
packages/oxlint/32-bit-arm.patch
Normal file
22
packages/oxlint/32-bit-arm.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
Prevents this build error when targeting 32-bit ARM:
|
||||
failed to resolve: use of unresolved module or unlinked crate `mimalloc_safe`
|
||||
|
||||
--- a/apps/oxlint/Cargo.toml
|
||||
+++ b/apps/oxlint/Cargo.toml
|
||||
@@ -41,13 +41,13 @@ serde_json = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, features = [] } # Omit the `regex` feature
|
||||
|
||||
-[target.'cfg(not(any(target_os = "linux", target_os = "freebsd", target_arch = "arm", target_family = "wasm")))'.dependencies]
|
||||
+[target.'cfg(not(any(target_os = "android", target_os = "freebsd", target_arch = "arm", target_family = "wasm")))'.dependencies]
|
||||
mimalloc-safe = { workspace = true, optional = true, features = ["skip_collect_on_exit"] }
|
||||
|
||||
-[target.'cfg(all(target_os = "linux", not(target_arch = "arm"), not(target_arch = "aarch64")))'.dependencies]
|
||||
+[target.'cfg(all(target_os = "android", not(target_arch = "arm"), not(target_arch = "aarch64")))'.dependencies]
|
||||
mimalloc-safe = { workspace = true, optional = true, features = ["skip_collect_on_exit", "local_dynamic_tls"] }
|
||||
|
||||
-[target.'cfg(all(target_os = "linux", target_arch = "aarch64"))'.dependencies]
|
||||
+[target.'cfg(all(target_os = "android", any(target_arch = "arm", target_arch = "aarch64")))'.dependencies]
|
||||
mimalloc-safe = { workspace = true, optional = true, features = ["skip_collect_on_exit", "local_dynamic_tls", "no_opt_arch"] }
|
||||
|
||||
[dev-dependencies]
|
||||
73
packages/oxlint/build.sh
Normal file
73
packages/oxlint/build.sh
Normal file
@@ -0,0 +1,73 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://oxc.rs/
|
||||
TERMUX_PKG_DESCRIPTION="Oxc JavaScript linter"
|
||||
TERMUX_PKG_LICENSE="MIT"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION="1.2.0"
|
||||
TERMUX_PKG_SRCURL="https://github.com/oxc-project/oxc/archive/refs/tags/oxlint_v$TERMUX_PKG_VERSION.tar.gz"
|
||||
TERMUX_PKG_SHA256=0625ba7fae24d11b534bdeb612f3d23402d201cc7e6537e4e6242b7acd24d726
|
||||
TERMUX_PKG_AUTO_UPDATE=true
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
|
||||
termux_pkg_auto_update() {
|
||||
# based on `termux_github_api_get_tag.sh`
|
||||
# fetch newest tags
|
||||
local newest_tags newest_tag
|
||||
newest_tags="$(curl -d "$(cat <<-EOF | tr '\n' ' '
|
||||
{
|
||||
"query": "query {
|
||||
repository(owner: \"oxc-project\", name: \"oxc\") {
|
||||
refs(refPrefix: \"refs/tags/\", first: 20, orderBy: {
|
||||
field: TAG_COMMIT_DATE, direction: DESC
|
||||
})
|
||||
{ edges { node { name } } }
|
||||
}
|
||||
}"
|
||||
}
|
||||
EOF
|
||||
)" \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
--silent \
|
||||
--location \
|
||||
--retry 10 \
|
||||
--retry-delay 1 \
|
||||
https://api.github.com/graphql \
|
||||
| jq '.data.repository.refs.edges[].node.name')"
|
||||
# filter only tags having "oxlint_v" and extract only raw version.
|
||||
read -r newest_tag < <(echo "$newest_tags" | grep -Po 'oxlint_v\K\d+\.\d+\.\d+' | sort -Vr)
|
||||
|
||||
[[ -z "${newest_tag}" ]] && termux_error_exit "ERROR: Unable to get tag from ${TERMUX_PKG_SRCURL}"
|
||||
termux_pkg_upgrade_version "${newest_tag}"
|
||||
}
|
||||
|
||||
termux_step_pre_configure() {
|
||||
termux_setup_rust
|
||||
termux_setup_nodejs
|
||||
termux_setup_cmake
|
||||
# Dummy CMake toolchain file to workaround build error:
|
||||
# error: failed to run custom build command for `libz-ng-sys v1.1.15`
|
||||
# ...
|
||||
# CMake Error at /home/builder/.termux-build/_cache/cmake-3.28.3/share/cmake-3.28/Modules/Platform/Android-Determine.cmake:217 (message):
|
||||
# Android: Neither the NDK or a standalone toolchain was found.
|
||||
export TARGET_CMAKE_TOOLCHAIN_FILE="$TERMUX_PKG_BUILDDIR/android.toolchain.cmake"
|
||||
touch "$TARGET_CMAKE_TOOLCHAIN_FILE"
|
||||
|
||||
: "${CARGO_HOME:=$HOME/.cargo}"
|
||||
export CARGO_HOME
|
||||
cargo fetch --target "$CARGO_TARGET_NAME"
|
||||
|
||||
# ld.lld: error: undefined symbol: __atomic_load_8
|
||||
if [[ "$TERMUX_ARCH" == "i686" ]]; then
|
||||
local -u env_host="${CARGO_TARGET_NAME//-/_}"
|
||||
export CARGO_TARGET_${env_host}_RUSTFLAGS+=" -C link-arg=$(${CC} -print-libgcc-file-name)"
|
||||
fi
|
||||
}
|
||||
|
||||
termux_step_make() {
|
||||
cargo build --jobs "$TERMUX_PKG_MAKE_PROCESSES" --target "$CARGO_TARGET_NAME" --release --all-features
|
||||
}
|
||||
|
||||
termux_step_make_install() {
|
||||
install -Dm700 -t "$TERMUX_PREFIX/bin" "target/$CARGO_TARGET_NAME/release/$TERMUX_PKG_NAME"
|
||||
install -Dm700 -t "$TERMUX_PREFIX/bin" "target/$CARGO_TARGET_NAME/release/oxc_language_server"
|
||||
}
|
||||
3
packages/oxlint/oxc-language-server.subpackage.sh
Normal file
3
packages/oxlint/oxc-language-server.subpackage.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
TERMUX_SUBPKG_DESCRIPTION="Oxc JavaScript linter language server"
|
||||
TERMUX_SUBPKG_INCLUDE="bin/oxc_language_server"
|
||||
TERMUX_SUBPKG_DEPEND_ON_PARENT=false
|
||||
Reference in New Issue
Block a user