#!/usr/bin/env bash
set -eu

SCRIPT_DIR=$(cd $(dirname $0);pwd)

if [ $# -lt 1 ]; then
  echo "usage: install.sh dest_ssp_dir"
  exit 1
else
  SSPDIR=$1
fi

cp -a ${SCRIPT_DIR}/arm64_gcc ${SSPDIR}/arch/
cp -a ${SCRIPT_DIR}/qemu_virt_gcc ${SSPDIR}/target/
(cd ${SSPDIR} && patch -p1 < ${SCRIPT_DIR}/ssp_aarch64.patch)

exit 0
