-
Notifications
You must be signed in to change notification settings - Fork 94
/
toolchain.sh
executable file
·47 lines (34 loc) · 1.21 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
#!/bin/sh
# toolchain.sh by Naomi Peori ([email protected])
## 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.
for SCRIPT in $DEPEND_SCRIPTS; do "$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; } done
## 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
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
## Run the build scripts.
for SCRIPT in $BUILD_SCRIPTS; do "$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; } done