Forked from CodeIter/termux-pacman-glibc-setup.sh
Last active
January 5, 2025 00:52
-
-
Save CennoxX/30dd20b36e79de899a9d4fd785bcca65 to your computer and use it in GitHub Desktop.
Setup `glibc-runner` with pacman on Termux and install Deno.JS.
This file contains hidden or 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
#!/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 | |
echo | |
pacman-key --init | |
echo | |
echo | |
pacman-key --populate | |
echo | |
echo | |
pacman -Syu | |
echo | |
echo | |
pacman -Sy glibc-runner --assume-installed bash,patchelf,resolv-conf | |
echo | |
echo | |
grun --help | |
echo | |
echo | |
curl -fsSL https://deno.land/install.sh | sh | |
echo | |
echo | |
export DENO_INSTALL="${HOME}/.deno" | |
export PATH="${PATH}:${DENO_INSTALL}/bin" | |
echo | |
echo | |
patchelf --print-interpreter --print-needed "$(which deno)" | |
echo | |
echo | |
patchelf --set-rpath "${PREFIX}/glibc/lib" --set-interpreter "${PREFIX}/glibc/lib/ld-linux-aarch64.so.1" "$(which deno)" | |
echo | |
echo | |
ldd "$(which deno)" | |
echo | |
echo | |
for i in deno ; do | |
cat - << EOF > ~/".${i}/bin/${i}.glibc.sh" | |
#!/usr/bin/env sh | |
_oldpwd="\${PWD}" | |
_dir="\$(dirname "\${0}")" | |
cd "\${_dir}" | |
if ! [ -h "${i}" ] ; then | |
>&2 mv -fv "${i}" "${i}.orig" | |
>&2 ln -sfv "${i}.glibc.sh" "${i}" | |
fi | |
cd "\${_oldpwd}" | |
LD_PRELOAD= exec "\${_dir}/${i}.orig" "\${@}" | |
# Or | |
#exec grun "\${_dir}/${i}.orig" "\${@}" | |
EOF | |
chmod -c u+x ~/".${i}/bin/${i}.glibc.sh" | |
done | |
echo | |
echo | |
deno.glibc.sh --version | |
echo | |
echo | |
tree -a ~/.deno | |
echo | |
echo | |
cat -n ~/.deno/bin/deno.glibc.sh | |
echo | |
echo | |
deno <<< "console.log('Hello world')" | |
echo | |
echo | |
echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc | |
source ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment