Skip to content

Instantly share code, notes, and snippets.

@CennoxX
Forked from CodeIter/termux-pacman-glibc-setup.sh
Last active October 8, 2025 09:01
Show Gist options
  • Save CennoxX/30dd20b36e79de899a9d4fd785bcca65 to your computer and use it in GitHub Desktop.
Save CennoxX/30dd20b36e79de899a9d4fd785bcca65 to your computer and use it in GitHub Desktop.
Install deno on Termux by setting up glibc-runner with pacman
#!/usr/bin/env -S bash -xeuo pipefail
pkg update && pkg upgrade
pkg install which time ldd tree
set -xeuo pipefail
pkg install pacman patchelf which time ldd tree
echo
pacman-key --init
echo
pacman-key --populate
echo
pacman -Syu
echo
pacman -Sy glibc-runner --assume-installed bash,patchelf,resolv-conf
echo
grun --help
echo
curl -fsSL https://deno.land/install.sh | sh
echo
export DENO_INSTALL="${HOME}/.deno"
export PATH="${PATH}:${DENO_INSTALL}/bin"
echo
patchelf --print-interpreter --print-needed "$(which deno)"
echo
patchelf --set-rpath "${PREFIX}/glibc/lib" --set-interpreter "${PREFIX}/glibc/lib/ld-linux-aarch64.so.1" "$(which deno)"
echo
ldd "$(which deno)"
echo
cat - << EOF > ~/".deno/bin/deno.glibc.sh"
#!/usr/bin/env sh
_oldpwd="\${PWD}"
_dir="\$(dirname "\${0}")"
cd "\${_dir}"
if ! [ -h "deno" ] ; then
>&2 mv -fv "deno" "deno.orig"
>&2 ln -sfv "deno.glibc.sh" "deno"
fi
cd "\${_oldpwd}"
LD_PRELOAD= exec "\${_dir}/deno.orig" "\${@}"
EOF
chmod -c u+x ~/".deno/bin/deno.glibc.sh"
echo
deno.glibc.sh --version
echo
tree -a ~/.deno
echo
cat -n ~/.deno/bin/deno.glibc.sh
echo
deno <<< "console.log('Hello world')"
echo
echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
#!/usr/bin/env -S bash -xeuo pipefail
curl -fsSL https://deno.land/install.sh | sh
patchelf --set-rpath "${PREFIX}/glibc/lib" --set-interpreter "${PREFIX}/glibc/lib/ld-linux-aarch64.so.1" "$(which deno)"
deno.glibc.sh <<< "console.log('Updated successfully')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment