#!/bin/sh

# Script for installation of PRISM-games on a clean install of Fedora-based Linux
# (current based on Amazon Linux, should be easy to adapt to RHEL/CentOS/etc.)

set -e # Abort if one of the commands fails
set -x # Print commands as they are executed

# Install dependencies: make/gcc/Java/git
sudo yum -y update
sudo yum -y install make gcc gcc-c++ java-11-amazon-corretto-devel git

# Install Python (only needed for testing (prism-auto) currently)
sudo yum -y install python

# Download the latest development version from GitHub
git clone https://github.com/prismmodelchecker/prism-games.git

# Compile PRISM-games and run a few tests (unless --nobuild passed)
# (should ultimately display: "Testing result: PASS")
if [ "$*" = "${*/--nobuild}" ]; then
  (cd prism-games/prism && make && make test testyices testz3 testppl)
fi
