Registrarse

[Herramienta] Aseprite en Linux de la forma más fácil

Jack Johnson

Hoenn Adventures Dev
Miembro del equipo
Administrador
Quiero compartir con vosotros una solución que he creado para simplificar la instalación de Aseprite en sistemas Linux. Si usas Linux como yo y has encontrado que el proceso de instalación desde el repositorio oficial no es tan claro como quisieras, ¡este script de Bash podría ser justo lo que necesitas!

Debian y derivados (Ubuntu, Linux Mint...)
Bash:
#!/bin/bash

# Replace with the current version
tag="v1.3-rc9"
# Replace with your desktop path (needed to create a shortcut)
desktoppath=~/Desktop

RED="\e[31m"
GREEN="\e[32m"
BLUE="\e[34m"
RESET="\e[0m"
B="\e[1m"
TITLE="\e[1;2;44m"
U="\e[4m"

TitleText="${TITLE}Installation script of Aseprite by ExcmoJack                           ${RESET}\n"

loop=1

clear
echo -e ${TitleText}
echo -e "This script will install Aseprite as is described at\n${U}${BLUE}https://github.com/aseprite/aseprite/blob/main/INSTALL.md${RESET}."
echo -e "It may ask you for ${B}sudo mode${RESET} at some time in order to download\nthe necessary packages to build Aseprite from source."

echo -e "\nAre you sure you want to continue?"
select continue in "Yes" "No"; do
        case $continue in
            Yes ) clear; break;;
            No ) clear; exit;;
        esac
done

# Update packages
echo -e ${TitleText}
echo -e "${GREEN}${B}Updating apt repositories...${RESET}"
sudo apt-get update
echo -e "${GREEN}Repositories are up to date! ✔️${RESET}"
read -p "Press enter to continue..."
clear

# Check dependencies
echo -e ${TitleText}
echo -e "${GREEN}${B}Checking and downloading dependencies...${RESET}"
echo -e "Warning: It may take some minutes!\n"
read -p "Press enter to continue..."
declare -a Packages=("git" "g++" "clang" "libc++-dev" "libc++abi-dev" "cmake" "ninja-build" "libx11-dev" "libxcursor-dev" "libxi-dev" "libgl1-mesa-dev" "libfontconfig1-dev" "unzip")
for pkg in "${Packages[@]}"; do
    checkpkg=$(dpkg-query -W -f='${Status}' $pkg 2>/dev/null | grep -c "ok installed")
    if [ $checkpkg -eq 0 ];
    then
        echo -e "${BLUE}Installing $pkg...${RESET}"
            sudo apt-get install $pkg
        echo -e "${GREEN}$pkg installed successfully! ✔️${RESET}"
    else
        echo -e "${BLUE}$pkg already installed! ✔️${RESET}"
    fi
done

if [ ! -f "$HOME/deps/skia/Skia-Linux-Release-x64-libc++.zip" ]; then
    wget -P $HOME/deps/skia "https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-Linux-Release-x64-libc++.zip"
fi
cd $HOME/deps/skia
if [ ! -f "$HOME/deps/skia/out/Release-x64/libskia.a" ]; then
    unzip "Skia-Linux-Release-x64-libc++.zip"
    echo -e "${GREEN}Skia unzipped successfully! ✔️${RESET}"
else
    echo -e "${BLUE}Skia already unzipped! ✔️${RESET}"
fi
echo -e "${GREEN}All dependencies were installed! ✔️${RESET}"
read -p "Press enter to continue..."
clear

# Check previous version
echo -e ${TitleText}
echo -e "${GREEN}${B}Checking previous versions...${RESET}"

cd "/usr/local/"
if [ ! -d "aseprite" ]; then
    echo -e "${RED} No others version found. Cloning...${RESET}"
    sudo git clone --recursive "https://github.com/aseprite/aseprite.git"
    echo -e "${GREEN}Repository cloned ✔️${RESET}"
else
    echo -e "${GREEN}Already found ✔️${RESET}"
fi
cd aseprite
sudo git checkout "tags/${tag}"
git pull
git submodule update --init --recursive
read -p "Press enter to continue..."
clear

# Build
echo -e ${TitleText}
echo -e "${GREEN}${B}Building aseprite...${RESET}"
if [ ! -d "build" ]; then
    sudo mkdir "build"
fi
cd "build"
export CC=clang
export CXX=clang++

sudo cmake \
    -DCMAKE_C_COMPILER=/usr/bin/$CC \
    -DCMAKE_CXX_COMPILER=/usr/bin/$CXX \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_CXX_FLAGS:STRING=-stdlib=libc++ \
    -DCMAKE_EXE_LINKER_FLAGS:STRING=-stdlib=libc++ \
    -DLAF_BACKEND=skia \
    -DSKIA_DIR=$HOME/deps/skia \
    -DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
    -DSKIA_LIBRARY=$HOME/deps/skia/out/Release-x64/libskia.a \
    -G Ninja \
    ..
sudo ninja aseprite
read -p "Press enter to continue..."
clear

# Create a launcher shortcut
echo -e ${TitleText}
echo -e "${GREEN}${B}Creating launcher shortcut...${RESET}"
cd /temp

output=aseprite.desktop

sudo printf "[Desktop Entry]
Version=1.0
Type=Application
Name=Aseprite
GenericName=Sprite Editor
Comment=Animated sprite editor & pixel art tool
Icon=/usr/local/aseprite/data/icons/ase.ico
Categories=Graphics;2DGraphics;RasterGraphics
Exec=/usr/local/aseprite/build/bin/aseprite %U
TryExec=/usr/local/aseprite/build/bin/aseprite
Terminal=false
StartupNotify=false
StartupWMClass=Aseprite
MimeType=image/bmp;image/gif;image/jpeg;image/png;image/x-pcx;image/x-tga;image/vnd.microsoft.icon;video/x-flic;image/webp;image/x-aseprite;" > $output

sudo cp aseprite.desktop "/usr/share/applications/"

rm aseprite.desktop
echo -e "${GREEN}${B}Done ✔️${RESET}"
read -p "Press enter to finish..."
Basta con guardar el script como install-aseprite.sh y ejecutarlo en tu terminal favorita, escribiendo la contraseña cuando se te pida (hay que instalar paquetes, así que te la pedirá al menos una vez).
Código:
user@debian:~$ ./install-aseprite.sh
 
Arriba