#!/bin/bash

version=3.9.2

install_packages build-essential libx11-dev libxpm-dev libxt-dev libxext-dev pkg-config libxml2-dev libgtk-3-dev libxinerama-dev libxtst-dev libgsl-dev libopencv-dev || exit 1

cd /tmp || error "Could not move to /tmp folder"
rm -rf /tmp/xsnow*
wget -O xsnow.tar.gz https://www.ratrabbit.nl/downloads/xsnow/xsnow-${version}.tar.gz || exit 1
tar -xvf xsnow.tar.gz || error "failed to extract"
cd xsnow-${version} || error "Could not move to xsnow directory folder"
./configure --prefix=/usr && make -j$(nproc) && sudo make install || error "Make install failed"
rm -rf /tmp/xsnow*
