-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_aocc
executable file
·36 lines (31 loc) · 1.29 KB
/
install_aocc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# Usage: bash install_aocc
REPO_NAME=aocc_flang
TMP_DIR="$(mktemp -d)"
cd "$TMP_DIR" || exit 42
git clone https://github.com/zaikunzhang/"$REPO_NAME".git
cd "$REPO_NAME" || exit 42
AOCC_7Z="aocc_flang.deb.7z.001"
7za x "$AOCC_7Z" -aoa # -aoa: overwrite all existing files without prompt
sudo apt update && sudo apt install p7zip-full libncurses* -y # libncurses* needed for libtinfo.so
sudo dpkg -i "$TMP_DIR"/"$REPO_NAME"/aocc_flang.deb
rm -rf "$TMP_DIR"
# Run the script that sets the necessary environment variables and then damp them to $GITHUB_ENV
# so that they are available in subsequent steps.
if [[ -d /opt/AMD ]] ; then
AOCCDIR="$(find /opt/AMD -maxdepth 1 -name "aocc-compiler*" -type d -print | sort | tail -n 1)"
AOCC_ENVSH="$(find "$AOCCDIR" -name "*setenv*.sh" -type f)"
#shellcheck disable=SC1090
source "$AOCC_ENVSH"
AFLANG="$(find "$AOCCDIR" -type f -executable -name "clang-*" | grep -E "clang-[0-9]{2}" | head -1)"
if [[ -n "$AFLANG" ]] ; then sudo ln -s "$AFLANG" "$(dirname "$AFLANG")"/aflang ; fi
export PATH=$(dirname "$AFLANG"):$PATH
else
exit 1
fi
env | grep -i 'aocc\|AMD' >> "$GITHUB_ENV"
# Show the result of the installation.
echo "The AOCC flang installed is:"
aflang --version
echo "The path to AOCC flang is:"
command -v aflang