Repository navigation
Expand file tree
/
Copy pathtoolchain.sh
More file actions
executable file
·62 lines (48 loc) · 1.47 KB
/
Copy pathtoolchain.sh
File metadata and controls
executable file
·62 lines (48 loc) · 1.47 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
set -eo pipefail
# toolchain.sh by Naomi Peori (naomi@peori.ca)
## Enter the ps3toolchain directory.
cd "`dirname $0`" || { echo "ERROR: Could not enter the ps3toolchain directory."; exit 1; }
## Create the build directory.
mkdir -p build && cd build || { echo "ERROR: Could not create the build directory."; exit 1; }
## Use gmake if available
which gmake 1>/dev/null 2>&1 && export MAKE=gmake
## Fetch the depend scripts.
DEPEND_SCRIPTS=`ls ../depends/*.sh | sort`
## Run all the depend scripts.
failed=0
for SCRIPT in $(ls ../depends/*.sh | sort); do
"$SCRIPT" || {
echo "$SCRIPT: Failed."
failed=1
}
done
[ "$failed" -ne 0 ] && exit "$failed"
## Fetch the build scripts.
BUILD_SCRIPTS=`ls ../scripts/*.sh | sort`
## If specific steps were requested...
if [ $1 ]; then
## Find the requested build scripts.
REQUESTS=""
for STEP in $@; do
SCRIPT=""
for i in $BUILD_SCRIPTS; do
echo ">>> Running: $SCRIPT"
if [ `basename $i | cut -d'-' -f1` -eq $STEP ]; then
SCRIPT=$i
break
fi
done
[ -z $SCRIPT ] && { echo "ERROR: unknown step $STEP"; exit 1; }
REQUESTS="$REQUESTS $SCRIPT"
done
## Only run the requested build scripts
BUILD_SCRIPTS="$REQUESTS"
fi
## A preset host CC, CXX, CPP, or LDFLAGS is picked up by the cross build.
unset CC CXX CPP LDFLAGS
## Run the build scripts.
for SCRIPT in $BUILD_SCRIPTS; do
echo ">>> Running: $SCRIPT"
"$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; }
done