-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_g95
More file actions
executable file
·37 lines (30 loc) · 1.2 KB
/
install_g95
File metadata and controls
executable file
·37 lines (30 loc) · 1.2 KB
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
37
#!/usr/bin/env bash
# Usage: bash install_g95
REPO_NAME="g95"
GIT_ADDR="https://github.com/zaikunzhang/$REPO_NAME.git"
TMP_DIR="$(mktemp -d)"
# Clone the g95 repository to the temporary directory
git clone "$GIT_ADDR" "$TMP_DIR/$REPO_NAME"
G95_zip="$TMP_DIR/$REPO_NAME/g95.zip"
# Decompress the g95 archive
mkdir -p "$HOME"/tmp
G95_DIR=$(mktemp -d -p "$HOME"/tmp/)
unzip "$G95_zip" -d "$G95_DIR"
G95_DIR="$G95_DIR/g95"
# Remove the temporary directory
rm -rf "$TMP_DIR"
# Make some links
CRT1="$(find /usr/ -type f -name "crt1.o*" -print -quit)"
CRTI="$(find /usr/ -type f -name "crti.o*" -print -quit)"
CRTN="$(find /usr/ -type f -name "crtn.o*" -print -quit)"
ln -s "$CRT1" "$G95_DIR/lib/gcc-lib/x86_64-unknown-linux-gnu/4.0.3/"
ln -s "$CRTI" "$G95_DIR/lib/gcc-lib/x86_64-unknown-linux-gnu/4.0.3/"
ln -s "$CRTN" "$G95_DIR/lib/gcc-lib/x86_64-unknown-linux-gnu/4.0.3/"
# Set environment variable for subsequent steps
echo "PATH=$PATH:$G95_DIR/bin:$G95_DIR/lib/gcc-lib/x86_64-unknown-linux-gnu/4.0.3" >> "$GITHUB_ENV"
# Show the result of the installation.
export PATH=$PATH:$G95_DIR/bin:$G95_DIR/lib/gcc-lib/x86_64-unknown-linux-gnu/4.0.3
echo "The g95 installed is:"
g95 --version
echo "The path to g95 is:"
command -v g95