name: Install Patmos and dependencies (Linux only)
description: Install Patmos and dependencies (Linux only)
runs:
  using: "composite"
  steps:
    - name: Setup
      run: |
        # install needed tools
        sudo apt install git openjdk-8-jdk cmake make g++ texinfo flex bison \
          subversion libelf-dev graphviz libboost-dev libboost-program-options-dev ruby-full \
          liblpsolve55-dev zlib1g-dev gtkwave gtkterm scala autoconf libfl2 expect verilator curl

        # install sbt

        sudo apt-get update
        sudo apt-get install apt-transport-https curl gnupg -yqq
        echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
        echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
        curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
        sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
        sudo apt-get update
        sudo apt-get install sbt

        # Clone the Patmos repository
        export PATH=$PATH:$HOME/t-crest/local/bin
        echo "PATH=$PATH:$HOME/t-crest/local/bin" >> "$GITHUB_ENV"
        echo $PATH
        mkdir ~/t-crest
        cd ~/t-crest
        git clone https://github.com/t-crest/patmos-misc.git misc
        ./misc/build.sh
        patmos-clang --version
        which patmos-clang
      shell: bash
