-
Notifications
You must be signed in to change notification settings - Fork 10
/
toolchain.sh
executable file
·55 lines (42 loc) · 1.72 KB
/
toolchain.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# toolchain.sh by fjtrujy
## Enter the pspdev directory.
cd "$(dirname "$0")" || { echo "ERROR: Could not enter the pspdev directory."; exit 1; }
## Create the build directory.
mkdir -p build || { echo "ERROR: Could not create the build directory."; exit 1; }
## Enter the build directory.
cd build || { echo "ERROR: Could not enter the build directory."; exit 1; }
## Fetch the depend scripts.
DEPEND_SCRIPTS=($(ls ../depends/*.sh | sort))
## Run all the depend scripts.
for SCRIPT in ${DEPEND_SCRIPTS[@]}; do "$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; } done
## Check if repo is in a tag, to install this specfic PSP Dev environment
if git describe --exact-match --tags $(git log -n1 --pretty='%h') >/dev/null 2>&1; then
TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
if [ "$TAG" = "latest" ]; then
## Ignore latest tag, as this tag is for service purposes only
echo "Installing latest environment status"
TAG="";
else
echo "Instaling specific version $TAG";
fi
else
echo "Installing latest environment status"
TAG=""
fi
## Fetch the build scripts.
BUILD_SCRIPTS=($(ls ../scripts/*.sh | sort))
## If specific steps were requested...
if [ "$1" ]; then
## Run the requested build scripts.
for STEP in "$@"; do "${BUILD_SCRIPTS[$STEP-1]}" "$TAG" || { echo "${BUILD_SCRIPTS[$STEP-1]}: Failed."; exit 1; } done
else
## Run the all build scripts.
for SCRIPT in ${BUILD_SCRIPTS[@]}; do "$SCRIPT" "$TAG" || { echo "$SCRIPT: Failed."; exit 1; } done
fi
## Store build information
BUILD_FILE="${PSPDEV}/build.txt"
if [[ -f "${BUILD_FILE}" ]]; then
sed -i'' '/^psptoolchain-allegrex /d' "${BUILD_FILE}"
fi
git log -1 --format="psptoolchain-allegrex %H %cs %s" >> "${BUILD_FILE}"