Skip to content

Commit df67b94

Browse files
authored
Merge pull request #7 from uyjulian/cleanup1
General cleanup 1
2 parents 1b0054c + 771327b commit df67b94

File tree

3 files changed

+51
-34
lines changed

3 files changed

+51
-34
lines changed

.github/workflows/docker.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
jobs:
1111
build:
1212
runs-on: ubuntu-latest
13+
env:
14+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
15+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
16+
DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
1317

1418
steps:
1519
- uses: actions/checkout@v2
@@ -32,11 +36,13 @@ jobs:
3236

3337
- name: Login to DockerHub
3438
uses: docker/login-action@v1
39+
if: env.DOCKER_USERNAME != null
3540
with:
3641
username: ${{ secrets.DOCKER_USERNAME }}
3742
password: ${{ secrets.DOCKER_PASSWORD }}
3843

3944
- uses: docker/build-push-action@v2
45+
if: env.DOCKER_USERNAME != null
4046
with:
4147
push: true
4248
tags: ${{ github.repository }}:${{ env.DOCKER_TAG }}
@@ -48,6 +54,7 @@ jobs:
4854
4955
- name: Repository Dispatch
5056
uses: peter-evans/repository-dispatch@v1
57+
if: env.DISPATCH_TOKEN != null
5158
with:
5259
repository: ${{ github.repository_owner }}/ps2toolchain
5360
token: ${{ secrets.DISPATCH_TOKEN }}

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,29 @@
33

44
# ps2toolchain-dvp
55

6-
This program will automatically build and install a DVP compiler which is used in the creation of homebrew software for the Sony PlayStation® 2 videogame system.
6+
This program will automatically build and install a DVP compiler, which is used in the creation of homebrew software for the Sony PlayStation® 2 videogame system.
77

8-
## **ATENTION!**
8+
## **ATTENTION**
99

10-
If you're trying to install in your machine the **WHOLE PS2 Development Environment** this is **NOT** the repo to use, you should use instead the [ps2dev](https://github.com/ps2dev/ps2dev "ps2dev") repo.
10+
If you're trying to install in your machine the **WHOLE PS2 Development Environment**, this is **NOT** the repo to use! Instead, you should use instead the [ps2dev](https://github.com/ps2dev/ps2dev "ps2dev") repo.
1111

1212
## What these scripts do
1313

14-
These scripts download (with wget) and install [binutils 2.14](http://www.gnu.org/software/binutils/ "binutils") (dvp).
14+
These scripts download (with `git clone`) and install [binutils 2.14](http://www.gnu.org/software/binutils/ "binutils") (dvp).
1515

1616
## Requirements
1717

18-
1. Install gcc/clang, make, patch, git, texinfo and wget if you don't have those.
19-
20-
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 its path! For example, on Linux systems you can set access for the current user by running commands:
21-
18+
1. Install gcc/clang, make, patch, git, and texinfo if you don't have those packages.
19+
2. Ensure that you have enough permissions for managing PS2DEV location (which defaults to `/usr/local/ps2dev`). PS2DEV location MUST NOT have spaces or special characters in its path! For example, on Linux systems, you can set access for the current user by running commands:
2220
```bash
2321
export PS2DEV=/usr/local/ps2dev
2422
sudo mkdir -p $PS2DEV
2523
sudo chown -R $USER: $PS2DEV
2624
```
27-
2825
3. Add this to your login script (example: `~/.bash_profile`)
29-
3026
```bash
3127
export PS2DEV=/usr/local/ps2dev
3228
export PATH=$PATH:$PS2DEV/dvp/bin
3329
```
34-
3530
4. Run toolchain.sh
3631
`./toolchain.sh`

scripts/001-binutils.sh

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
#!/bin/bash
22
# binutils-2.14.sh by Francisco Javier Trujillo Mata ([email protected])
33

4+
## Exit with code 1 when any command executed returns a non-zero exit code.
5+
onerr()
6+
{
7+
exit 1;
8+
}
9+
trap onerr ERR
10+
411
## Download the source code.
512
REPO_URL="https://github.com/ps2dev/binutils-gdb.git"
613
REPO_FOLDER="binutils-gdb"
714
BRANCH_NAME="dvp-v2.14"
815
if test ! -d "$REPO_FOLDER"; then
9-
git clone --depth 1 -b $BRANCH_NAME $REPO_URL && cd "$REPO_FOLDER" || exit 1
16+
git clone --depth 1 -b "$BRANCH_NAME" "$REPO_URL"
1017
else
11-
cd "$REPO_FOLDER" && git fetch origin && git reset --hard "origin/${BRANCH_NAME}" && git checkout "$BRANCH_NAME" || exit 1
18+
git -C "$REPO_FOLDER" fetch origin
19+
git -C "$REPO_FOLDER" reset --hard "origin/${BRANCH_NAME}"
20+
git -C "$REPO_FOLDER" checkout "$BRANCH_NAME"
1221
fi
22+
cd "$REPO_FOLDER"
1323

1424
TARGET_ALIAS="dvp"
15-
TARGET="dvp"
1625
TARG_XTRA_OPTS=""
1726
OSVER=$(uname)
1827

@@ -31,23 +40,29 @@ fi
3140
## Determine the maximum number of processes that Make can work with.
3241
PROC_NR=$(getconf _NPROCESSORS_ONLN)
3342

34-
## Create and enter the toolchain/build directory
35-
rm -rf build-$TARGET && mkdir build-$TARGET && cd build-$TARGET || { exit 1; }
36-
37-
## Configure the build.
38-
../configure \
39-
--quiet \
40-
--prefix="$PS2DEV/$TARGET_ALIAS" \
41-
--target="$TARGET" \
42-
--disable-nls \
43-
--disable-build-warnings \
44-
$TARG_XTRA_OPTS || { exit 1; }
45-
46-
## Compile and install.
47-
make --quiet -j $PROC_NR clean || { exit 1; }
48-
make --quiet -j $PROC_NR CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 -O2 -Wno-implicit-function-declaration" LDFLAGS="$LDFLAGS -s" || { exit 1; }
49-
make --quiet -j $PROC_NR install || { exit 1; }
50-
make --quiet -j $PROC_NR clean || { exit 1; }
51-
52-
## Exit the build directory.
53-
cd .. || { exit 1; }
43+
## For each target...
44+
for TARGET in "dvp"; do
45+
## Create and enter the toolchain/build directory
46+
rm -rf "build-$TARGET"
47+
mkdir "build-$TARGET"
48+
cd "build-$TARGET"
49+
50+
## Configure the build.
51+
../configure \
52+
--quiet \
53+
--prefix="$PS2DEV/$TARGET_ALIAS" \
54+
--target="$TARGET" \
55+
--disable-nls \
56+
--disable-build-warnings \
57+
$TARG_XTRA_OPTS
58+
59+
## Compile and install.
60+
make --quiet -j "$PROC_NR" CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=0 -O2 -Wno-implicit-function-declaration" LDFLAGS="$LDFLAGS -s"
61+
make --quiet -j "$PROC_NR" install
62+
make --quiet -j "$PROC_NR" clean
63+
64+
## Exit the build directory.
65+
cd ..
66+
67+
## End target.
68+
done

0 commit comments

Comments
 (0)