|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +function error { |
| 4 | + echo -e "\\e[91m$1\\e[39m" |
| 5 | + sleep 3 |
| 6 | + exit 1 |
| 7 | +} |
| 8 | + |
| 9 | +clear -x |
| 10 | +echo "Vita3k script successfully started!" |
| 11 | +echo "Credits: https://github.com/Vita3K/Vita3K/blob/master/building.md#linux" |
| 12 | +sleep 3 |
| 13 | + |
| 14 | +echo "Installing dependencies..." |
| 15 | +sleep 1 |
| 16 | + |
| 17 | +case "$__os_id" in |
| 18 | +Raspbian | Debian | Ubuntu) |
| 19 | + |
| 20 | + case "$__os_codename" in |
| 21 | + bionic | focal) |
| 22 | + #installs LLVM-14 toolchain |
| 23 | + curl https://apt.llvm.org/llvm.sh | sudo bash -s "14" || error "apt.llvm.org installer failed!" |
| 24 | + |
| 25 | + sudo apt install -y libc++-14-dev libc++abi-14-dev libstdc++6 libclang-14-dev clang-14 clang-tools-14 llvm-14 || error "Could not install dependencies" |
| 26 | + sudo apt install -y git cmake ninja-build libsdl2-dev pkg-config libgtk-3-dev xdg-desktop-portal openssl libssl-dev || error "Could not install dependencies" |
| 27 | + ;; |
| 28 | + jammy) |
| 29 | + echo "TODO" |
| 30 | + ;; |
| 31 | + *) |
| 32 | + sudo apt install -y git cmake ninja-build libsdl2-dev pkg-config libgtk-3-dev clang lld xdg-desktop-portal openssl libssl-dev || error "Could not install dependencies" |
| 33 | + ;; |
| 34 | + esac |
| 35 | + |
| 36 | + |
| 37 | + ;; |
| 38 | + |
| 39 | +Fedora) |
| 40 | + sudo dnf install -y git cmake ninja-build SDL2-devel pkg-config gtk3-devel clang lld xdg-desktop-portal openssl openssl-devel libstdc++-static || error "Could not install dependencies!" |
| 41 | + ;; |
| 42 | +*) |
| 43 | + echo -e "\\e[91mUnknown distro detected - this script should work, but please press Ctrl+C now and install necessary dependencies yourself following https://github.com/Vita3K/Vita3K/blob/master/building.md#linux if you haven't already...\\e[39m" |
| 44 | + sleep 5 |
| 45 | + ;; |
| 46 | +esac |
| 47 | + |
| 48 | +echo "Building Vita3k..." |
| 49 | +sleep 1 |
| 50 | +cd ~ |
| 51 | +git clone --recurse-submodules -j$(nproc) https://github.com/Vita3K/Vita3K |
| 52 | +cd Vita3k |
| 53 | +git pull --recurse-submodules -j$(nproc) || error "Could Not Pull Latest Source Code" |
| 54 | +git submodule update --init --recursive || error "Could Not Pull All Submodules" |
| 55 | + |
| 56 | +# rm -rf build/linux-ninja-clang # resets build directory |
| 57 | + |
| 58 | +# TODO: this makes a debug build. do we want that? |
| 59 | +case "$__os_codename" in |
| 60 | +bionic | focal) |
| 61 | + cmake --preset linux-ninja-clang -DCMAKE_CXX_FLAGS=-mcpu=native -DCMAKE_C_FLAGS=-mcpu=native -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 |
| 62 | + cmake --build/linux-ninja-clang -DCMAKE_CXX_FLAGS=-mcpu=native -DCMAKE_C_FLAGS=-mcpu=native -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 |
| 63 | + ;; |
| 64 | +*) |
| 65 | + cmake --preset linux-ninja-clang |
| 66 | + cmake --build build/linux-ninja-clang |
| 67 | + ;; |
| 68 | +esac |
| 69 | + |
| 70 | +#TODO: installation |
| 71 | + |
| 72 | +echo "Done!" |
| 73 | +echo "Sending you back to the main menu..." |
| 74 | +sleep 5 |
0 commit comments