-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtoolchain.sh
executable file
·59 lines (44 loc) · 1.54 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
56
57
58
59
#!/bin/sh
# toolchain.sh by Dan Peori (dan.peori@oopo.net)
## Setup our environmental variable for the dependency scripts so we don't exit the first time one fails.
depends_not_met=0;
env_not_set=0;
## 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"; done
## Check to see if any dependencies weren't met and if so, exit
if [ ${depends_not_met} -eq 1 ] || [ ${env_not_set} -eq 1 ]; then
if [ ${depends_not_met} -eq 1 ]; then
echo " before continuing.";
fi;
exit 1;
fi
## 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