From 808b803617683648c05aee7b50b162f19a1ac78b Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Fri, 12 Dec 2025 18:01:23 -0600 Subject: [PATCH] Add install script --- content/downloads/_index.md | 5 ++ static/crosslang-install.sh | 133 ++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100755 static/crosslang-install.sh diff --git a/content/downloads/_index.md b/content/downloads/_index.md index 043e8bb..6ef17d3 100644 --- a/content/downloads/_index.md +++ b/content/downloads/_index.md @@ -4,6 +4,11 @@ type = "chapter" weight = 1 +++ +If you use Linux, MacOS or FreeBSD you can also use this command to install +```bash +curl -o crosslang-install.sh https://crosslang.tesseslanguage.com/crosslang-install.sh && sh crosslang-install.sh; rm crosslang-install.sh +``` + - [Linux](linux) - [Windows](windows.md) - [Shell Binary](https://downloads.tesses.net/ShellPackage.crvm) \ No newline at end of file diff --git a/static/crosslang-install.sh b/static/crosslang-install.sh new file mode 100755 index 0000000..b422fa5 --- /dev/null +++ b/static/crosslang-install.sh @@ -0,0 +1,133 @@ +#!/usr/bin/env sh +OS=`uname -s` +ARCH=`uname -m` + +OsLinux() { + . /etc/os-release + case $ID in + "arch" ) + OsArchLinux ;; + "debian" ) + OsDebianLinux ;; + "ubuntu" ) + OsUbuntuLinux ;; + esac +} + +CompileFromSourceConfirmed() { + git clone https://onedev.site.tesses.net/crosslang || exit 1 + cd crosslang + mkdir -p build + cd build + cmake -S .. -B . + CPUS := $(shell nproc 2>/dev/null || echo 1) + make -j`$CPUS` + while true; do + read -p "Do you want to install it (Y/n)? " yn + case $yn in + [Yy]* ) sudo make install; break;; + [Nn]* ) break;; + * ) echo "Please answer yes or no.";; + esac + done + while true; do + read -p "Do you want to delete the source code (Y/n)? " yn + case $yn in + [Yy]* ) cd ../..; rm -rf crosslang; break;; + [Nn]* ) break;; + * ) echo "Please answer yes or no.";; + esac + done +} + +CompileFromSource() { + while true; do + echo "Required dependencies: cmake and a compiler" + read -p "Your platform configuration does not have a binary, do you want to compile from source (Y/n)? " yn + case $yn in + [Yy]* ) CompileFromSourceConfirmed; break;; + [Nn]* ) break;; + * ) echo "Please answer yes or no.";; + esac + done +} +OldDistroMessage() { + if [ "$ARCH" = "ppc" ]; then + if cat /proc/cpuinfo | grep wii > /dev/null; then + echo "You can upgrade to the Wii Linux Continuation Project" + echo "Make sure its the arch linux version" + echo "Here is the link to the page: https://wii-linux.org/downloads" + echo "Or via another linux machine you can cross compile for powerpc" + echo "using musl and staticly linking to musl" + exit 1 + fi + fi + echo "You will need to cross compile a static build using musl, sorry" + exit 1 +} + +OsArchLinux() { + if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "ppc"]; then + wget -O repository.key https://git.tesseslanguage.com/api/packages/tesses50/arch/repository.key + sudo pacman-key --add repository.key + rm repository.key + printf "[tesses50.git.tesseslanguage.com]\nSigLevel = Optional TrustAll\nServer = https://git.tesseslanguage.com/api/packages/tesses50/arch/core/\$arch\n" | sudo tee -a /etc/pacman.conf + sudo pacman -Sy crosslang + else + CompileFromSource + fi +} +OsDebianLinux() { + if [ "$VERSION_ID" -lt "12" ]; then + OldDistroMessage + elif [ "$VERSION_ID" -lt "13" ]; then + if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "riscv64" ]; then + sudo curl https://git.tesseslanguage.com/api/packages/tesses50/debian/repository.key -o /etc/apt/keyrings/gitea-tesses50.asc + echo "deb [signed-by=/etc/apt/keyrings/gitea-tesses50.asc] https://git.tesseslanguage.com/api/packages/tesses50/debian jammy main" | sudo tee -a /etc/apt/sources.list.d/gitea.list + sudo apt update + sudo apt install crosslang + else + CompileFromSource + fi + else + if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "riscv64" ]; then + sudo curl https://git.tesseslanguage.com/api/packages/tesses50/debian/repository.key -o /etc/apt/keyrings/gitea-tesses50.asc + echo "deb [signed-by=/etc/apt/keyrings/gitea-tesses50.asc] https://git.tesseslanguage.com/api/packages/tesses50/debian plucky main" | sudo tee -a /etc/apt/sources.list.d/gitea.list + sudo apt update + sudo apt install crosslang + else + CompileFromSource + fi + fi +} +OsUbuntuLinux() { + if [ 1 -eq "$(echo "$VERSION_ID 22.04" | awk '{print ($1 < $2)}')" ]; then + OldDistroMessage + elif [ 1 -eq "$(echo "$VERSION_ID 25.04" | awk '{print ($1 < $2)}')" ]; then + if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "riscv64" ]; then + sudo curl https://git.tesseslanguage.com/api/packages/tesses50/debian/repository.key -o /etc/apt/keyrings/gitea-tesses50.asc + echo "deb [signed-by=/etc/apt/keyrings/gitea-tesses50.asc] https://git.tesseslanguage.com/api/packages/tesses50/debian jammy main" | sudo tee -a /etc/apt/sources.list.d/gitea.list + sudo apt update + sudo apt install crosslang + else + CompileFromSource + fi + else + if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "riscv64" ]; then + sudo curl https://git.tesseslanguage.com/api/packages/tesses50/debian/repository.key -o /etc/apt/keyrings/gitea-tesses50.asc + echo "deb [signed-by=/etc/apt/keyrings/gitea-tesses50.asc] https://git.tesseslanguage.com/api/packages/tesses50/debian plucky main" | sudo tee -a /etc/apt/sources.list.d/gitea.list + sudo apt update + sudo apt install crosslang + else + CompileFromSource + fi + fi +} + + +case $OS in + "Linux") + OsLinux ;; + *) + CompileFromSource ;; +esac