Skip to content

Commit 60003b6

Browse files
committed
Fixed scripts not producing failing code
Fixed scripts to handle complex paths and tags Various cleanups
1 parent 59ba5a7 commit 60003b6

10 files changed

+66
-47
lines changed

.github/workflows/compilation.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v2
21-
21+
2222
- name: Install Ubuntu texinfo bison flex
2323
if: matrix.os[0] == 'ubuntu-latest'
2424
run: |
2525
sudo apt-get update
2626
sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev
27-
27+
2828
- name: Install Mac texinfo bison flex
2929
if: matrix.os[0] == 'macOS-latest'
3030
run: |

.github/workflows/docker.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ on:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15-
15+
1616
steps:
1717
- uses: actions/checkout@v2
1818

1919
- name: Extract DOCKER_TAG using tag name
2020
if: startsWith(github.ref, 'refs/tags/')
2121
run: |
2222
echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
23-
23+
2424
- name: Use default DOCKER_TAG
2525
if: startsWith(github.ref, 'refs/tags/') != true
2626
run: |
2727
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
2828
2929
- name: Set up QEMU
3030
uses: docker/setup-qemu-action@v1
31-
31+
3232
- name: Set up Docker Buildx
3333
uses: docker/setup-buildx-action@v1
34-
34+
3535
- name: Login to DockerHub
36-
uses: docker/login-action@v1
36+
uses: docker/login-action@v1
3737
with:
3838
username: ${{ secrets.DOCKER_USERNAME }}
3939
password: ${{ secrets.DOCKER_PASSWORD }}
40-
40+
4141
- uses: docker/build-push-action@v2
4242
with:
4343
push: true
@@ -46,7 +46,7 @@ jobs:
4646
BASE_DOCKER_DVP_IMAGE=${{ github.repository_owner }}/ps2toolchain-dvp:${{ env.DOCKER_TAG }}
4747
BASE_DOCKER_IOP_IMAGE=${{ github.repository_owner }}/ps2toolchain-iop:${{ env.DOCKER_TAG }}
4848
BASE_DOCKER_EE_IMAGE=${{ github.repository_owner }}/ps2toolchain-ee:${{ env.DOCKER_TAG }}
49-
49+
5050
- name: Send Compile action
5151
run: |
5252
export DISPATCH_ACTION="$(echo run_build)"
@@ -58,4 +58,4 @@ jobs:
5858
repository: ${{ github.repository_owner }}/ps2sdk
5959
token: ${{ secrets.DISPATCH_TOKEN }}
6060
event-type: ${{ env.NEW_DISPATCH_ACTION }}
61-
client-payload: '{"ref": "${{ github.ref }}"}'
61+
client-payload: '{"ref": "${{ github.ref }}"}'

.gitignore

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1+
#
2+
# NOTE! Please use 'git ls-files -i --exclude-standard -c'
3+
# command after changing this file, to see if there are
4+
# any tracked files which get ignored after the change.
5+
#
6+
# Normal rules
7+
#
18
build/
2-
.DS_Store
9+
.*
10+
11+
#
12+
# files that we don't want to ignore
13+
#
14+
!.gitignore
15+
!.gitattributes
16+
!.github
17+
!.editorconfig
18+
!.clang-format

README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,32 @@ If you're trying to install in your machine the **WHOLE PS2 Development Environm
1212
## What these scripts do
1313

1414
These scripts download (with `wget`/`git clone`) and install:
15-
- [binutils 2.14](http://www.gnu.org/software/binutils/ "binutils") (iop, dvp)
16-
- [binutils 2.35.1](http://www.gnu.org/software/binutils/ "binutils") (ee),
17-
- [gcc 3.2.3](https://gcc.gnu.org/ "gcc") (iop)
18-
- [gcc 10.2.0](https://gcc.gnu.org/ "gcc") (ee)
19-
- [newlib 4.0.0](https://sourceware.org/newlib/ "newlib") (ee)
15+
16+
- [binutils 2.14](http://www.gnu.org/software/binutils/ "binutils") (iop, dvp)
17+
- [binutils 2.35.1](http://www.gnu.org/software/binutils/ "binutils") (ee),
18+
- [gcc 3.2.3](https://gcc.gnu.org/ "gcc") (iop)
19+
- [gcc 10.2.0](https://gcc.gnu.org/ "gcc") (ee)
20+
- [newlib 4.0.0](https://sourceware.org/newlib/ "newlib") (ee)
2021

2122
## Requirements
2223

23-
1. Install gcc/clang, make, patch, git, texinfo, flex, bison, wget, gsl, gmp, mpfr, mpc and gettext if you don't have those.
24+
1. Install gcc/clang, make, patch, git, texinfo, flex, bison, wget, gsl, gmp, mpfr, mpc and gettext if you don't have those.
25+
26+
2. Ensure that you have enough permissions for managing PS2DEV location (default to `/usr/local/ps2dev`). PS2DEV location MUST NOT have spaces or special characters in it's path! For example on Linux systems you can set access for current user by running commands:
2427

25-
2. Ensure that you have enough permissions for managing PS2DEV location (default to `/usr/local/ps2dev`). PS2DEV location MUST NOT have spaces or special characters in it's path! For example on Linux systems you can set access for current user by running commands:
2628
```bash
2729
export PS2DEV=/usr/local/ps2dev
2830
sudo mkdir -p $PS2DEV
2931
sudo chown -R $USER: $PS2DEV
3032
```
3133

32-
3. Add this to your login script (example: `~/.bash_profile`)
34+
3. Add this to your login script (example: `~/.bash_profile`)
35+
3336
```bash
3437
export PS2DEV=/usr/local/ps2dev
3538
export PS2SDK=$PS2DEV/ps2sdk
3639
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
3740
```
3841

39-
4. Run toolchain.sh
40-
`./toolchain.sh`
42+
4. Run toolchain.sh
43+
`./toolchain.sh`

depends/check-texinfo.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# check-texinfo.sh by Dan Peori ([email protected])
33

44
## Check for texinfo.
5-
makeinfo --version 1> /dev/null || { echo "ERROR: Install texinfo before continuing."; exit 1; }
5+
makeinfo --version 1> /dev/null || { echo "ERROR: Install texinfo before continuing."; exit 1; }

scripts/001-dvp.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ REPO_URL="https://github.com/ps2dev/ps2toolchain-dvp"
66
REPO_FOLDER="ps2toolchain-dvp"
77

88
# Checking if a specific TAG has been selected, it is passed using parameter $1
9-
[ -z "$1" ] && REPO_REFERENCE="origin/main" || REPO_REFERENCE=$1
9+
[ -z "$1" ] && REPO_REFERENCE="main" || REPO_REFERENCE=$1
1010
echo "Using repo reference $REPO_REFERENCE"
1111

1212
if test ! -d "$REPO_FOLDER"; then
13-
git clone $REPO_URL|| exit 1
13+
git clone $REPO_URL -b "${REPO_REFERENCE}" || exit 1
1414
fi
15-
cd $REPO_FOLDER && git fetch origin && git reset --hard ${REPO_REFERENCE} || exit 1
15+
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${REPO_REFERENCE}" && git checkout "${REPO_REFERENCE}" || exit 1
1616

17-
## Build and install
18-
./toolchain.sh
17+
## Build and install.
18+
./toolchain.sh || { exit 1; }

scripts/002-iop.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ REPO_URL="https://github.com/ps2dev/ps2toolchain-iop"
66
REPO_FOLDER="ps2toolchain-iop"
77

88
# Checking if a specific TAG has been selected, it is passed using parameter $1
9-
[ -z "$1" ] && REPO_REFERENCE="origin/main" || REPO_REFERENCE=$1
9+
[ -z "$1" ] && REPO_REFERENCE="main" || REPO_REFERENCE=$1
1010
echo "Using repo reference $REPO_REFERENCE"
1111

1212
if test ! -d "$REPO_FOLDER"; then
13-
git clone $REPO_URL|| exit 1
13+
git clone $REPO_URL -b "${REPO_REFERENCE}" || exit 1
1414
fi
15-
cd $REPO_FOLDER && git fetch origin && git reset --hard ${REPO_REFERENCE} || exit 1
15+
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${REPO_REFERENCE}" && git checkout "${REPO_REFERENCE}" || exit 1
1616

17-
## Build and install
18-
./toolchain.sh
17+
## Build and install.
18+
./toolchain.sh || { exit 1; }

scripts/003-ee.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ REPO_URL="https://github.com/ps2dev/ps2toolchain-ee"
66
REPO_FOLDER="ps2toolchain-ee"
77

88
# Checking if a specific TAG has been selected, it is passed using parameter $1
9-
[ -z "$1" ] && REPO_REFERENCE="origin/main" || REPO_REFERENCE=$1
9+
[ -z "$1" ] && REPO_REFERENCE="main" || REPO_REFERENCE=$1
1010
echo "Using repo reference $REPO_REFERENCE"
1111

1212
if test ! -d "$REPO_FOLDER"; then
13-
git clone $REPO_URL|| exit 1
13+
git clone $REPO_URL -b "${REPO_REFERENCE}" || exit 1
1414
fi
15-
cd $REPO_FOLDER && git fetch origin && git reset --hard ${REPO_REFERENCE} || exit 1
15+
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${REPO_REFERENCE}" && git checkout "${REPO_REFERENCE}" || exit 1
1616

17-
## Build and install
18-
./toolchain.sh
17+
## Build and install.
18+
./toolchain.sh || { exit 1; }

toolchain-sudo.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# toolchain-sudo.sh by Naomi Peori ([email protected])
33

44
## Enter the ps2toolchain directory.
5-
cd "`dirname $0`" || { echo "ERROR: Could not enter the ps2toolchain directory."; exit 1; }
5+
cd "$(dirname "$0")" || { echo "ERROR: Could not enter the ps2toolchain directory."; exit 1; }
66

77
## Set up the environment.
88
export PS2DEV=/usr/local/ps2dev
@@ -14,4 +14,4 @@ export PATH=$PATH:$PS2DEV/dvp/bin
1414
export PATH=$PATH:$PS2SDK/bin
1515

1616
## Run the toolchain script.
17-
./toolchain.sh $@ || { echo "ERROR: Could not run the toolchain script."; exit 1; }
17+
./toolchain.sh "$@" || { echo "ERROR: Could not run the toolchain script."; exit 1; }

toolchain.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# toolchain.sh by Naomi Peori ([email protected])
33

44
## Enter the ps2toolchain directory.
5-
cd "`dirname $0`" || { echo "ERROR: Could not enter the ps2toolchain directory."; exit 1; }
5+
cd "$(dirname "$0")" || { echo "ERROR: Could not enter the ps2toolchain directory."; exit 1; }
66

77
## Create the build directory.
88
mkdir -p build || { echo "ERROR: Could not create the build directory."; exit 1; }
@@ -11,7 +11,7 @@ mkdir -p build || { echo "ERROR: Could not create the build directory."; exit 1;
1111
cd build || { echo "ERROR: Could not enter the build directory."; exit 1; }
1212

1313
## Fetch the depend scripts.
14-
DEPEND_SCRIPTS=(`ls ../depends/*.sh | sort`)
14+
DEPEND_SCRIPTS=$(ls ../depends/*.sh | sort)
1515

1616
## Run all the depend scripts.
1717
for SCRIPT in ${DEPEND_SCRIPTS[@]}; do "$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; } done
@@ -26,17 +26,17 @@ else
2626
fi
2727

2828
## Fetch the build scripts.
29-
BUILD_SCRIPTS=(`ls ../scripts/*.sh | sort`)
29+
BUILD_SCRIPTS=$(ls ../scripts/*.sh | sort)
3030

3131
## If specific steps were requested...
32-
if [ $1 ]; then
32+
if [ "$1" ]; then
3333

34-
## Run the requested build scripts.
35-
for STEP in $@; do "${BUILD_SCRIPTS[$STEP-1]}" $TAG || { echo "${BUILD_SCRIPTS[$STEP-1]}: Failed."; exit 1; } done
34+
## Run the requested build scripts.
35+
for STEP in "$@"; do "${BUILD_SCRIPTS[$STEP-1]}" "$TAG" || { echo "${BUILD_SCRIPTS[$STEP-1]}: Failed."; exit 1; } done
3636

3737
else
3838

39-
## Run the all build scripts.
40-
for SCRIPT in ${BUILD_SCRIPTS[@]}; do "$SCRIPT" $TAG || { echo "$SCRIPT: Failed."; exit 1; } done
39+
## Run the all build scripts.
40+
for SCRIPT in ${BUILD_SCRIPTS[@]}; do "$SCRIPT" "$TAG" || { echo "$SCRIPT: Failed."; exit 1; } done
4141

4242
fi

0 commit comments

Comments
 (0)